You are required to write a
program for calculating the amount of bill paid by the customer for both
domestic and commercial usage. User will enter customer number and amount of
units consumed, and the program will calculate the amount of bill
accordingly.
- The program
should take customer type as input which must be ‘1’ or ‘2’and the
number of units consumed.
- If the user
enters ‘1’ then he/she is a
domestic user.
- If the user
enters ‘2’ then he/she is a
commercial user.
- If user enters any other number except
1 or 2, the program should
terminate after displaying a message “Invalid choice”.
- After taking valid customer type from
user, program should ask user to enter the customer number, number of
consumed units and number of days.
- For domestic customer, if the units consumed are between 0 and 100, the price is Rs.5 per unit and there will be
no extra charges.
- If the units consumed are between 101 and 300, the price is
Rs.8 per unit plus Rs.100
as extra charges.
- If the units consumed are between 301 and 500, the price is
Rs.10 per unit plus Rs.230 as extra charges.
- For commercial customers, the price is
Rs.15 per unit, which is
uniform for any number of units.
- If user deposits bill within 10 days, he/she will not
be incurred for any extra charges.
- If user deposits bill after 10 days, he/she will be
charges for Rs. 200 as extra charges.
- You are required to write 2 functions.
One for calculating the bill for domestic customer, and 2nd
to calculate the bill for commercial customer.
- Use switch structure to determine the customer type. Then pass
the customer number, consumed units and number of days to the
corresponding function as arguments.
- These functions will calculate and
return the total bill for the customer.
The sample output
is attached with this assignment named Assignment2.gif.
|
No comments:
Post a Comment