Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that will calculate and print bills for the city power company.

ID: 3651585 • Letter: W

Question

Write a 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 code of I means industrial
use. Any other code should be treated as an error.
The rates are computed as follows:
R: $6.00 plus $0.052 per kwh used.
C: $60.00 for the first 1000 kwh and $0.045 for each additional kwh
I: rate varies depending on time of usage:
Peak hours: $76.00 for first 1000 kwh and $0.065 for each additional kwh
Off-peak hours $40.00 for first 1000 kwh and $0.028 for each additional kwh.

Your program should prompt the user to enter an integer account number, the use code
(type char), and the necessary consumption figures in whole number of kilowattshours. Your program should display the input values and the calculated value, the
amount due from the user.


Program Requirements:

Explanation / Answer

#include void main() { // commercial customer const int COM_LIMIT = 1000; const double COM_RATE = 0.045; const double COM_FEE = 60; // residential customer const double RES_RATE = 6.052; // industrial customer const int IND_LIMIT = 1000; const double IND_RATE_PEAK = .065; const double IND_FEE_PEAK = 76; const double IND_RATE_OFF = .028; const double IND_FEE_OFF = 40; int account, consumption=0, off_consumption=0, peak_consumption=0; double bill=0.0; char code; printf("Please enter your account number: "); scanf("%d", &account); printf(" Please enter your use code (R, C or I): "); scanf("%c", &code); if (code=='r' || code=='R') { printf(" Please enter your consumption figures in whole numbers of kwh: "); scanf("%d", &consumption); bill = consumption*RES_RATE; } if (code=='c' || code=='C') { printf(" Please enter your consumption figures in whole numbers of kwh: "); scanf("%d", &consumption); if (consumption
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote