Reference no: EM132355316
Question
Write program that will calculate and print bills for the city power company. The rates vary depending on whether the use is residential, commercial, or industrial. A code of R means residential use, a code of C means commercial use, and a code of I means industrial use.
The rates are computed as follows:
R: RM6.00 plus RM0.052 per kwh used
C: RM60.00 for the first 1000 kwh and RM0.045 for each additional kwh
I: Rate varies depending on time of usage:
Peak hours: RM76.00 for first 1000 kwh
and RM0.065 for each additional kwh
Off peak hours: RM40.00 for first 1000 kwh
and RM0.028 for each additional kwh.
Your program should prompt the user to enter the use code, and the necessary consumption figures in whole numbers of kilowatt-hours.
Note that if the code is I, an additional input to determine whether it is peak or off peak is required.
Your program should display the amount due from the user, rounded to 2 decimal points.
NOTE: You may assume that user will always enter valid data when prompted, and thus you do not need to do any data validation.