Question: #include void main() { // commercial customer const int COM_LIMIT = 1000; const double COM_RATE = 0.045; const double COM_FEE = 60; // residential customer

#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 < COM_LIMIT) bill = COM_FEE; else bill = (consumption*COM_RATE) + COM_FEE; } if (code=='i' || code=='I') { printf(" Please enter your off-peak consumption figures in whole numbers of kwh: "); scanf("%d", &off_consumption); if (off_consumption < IND_LIMIT) bill = IND_FEE_OFF; else if (off_consumption >= IND_LIMIT) bill = (consumption*IND_RATE_PEAK) + IND_FEE_PEAK; printf(" Please enter your peak consumption figures in whole numbers of kwh: "); scanf("%d", &peak_consumption); if (peak_consumption < IND_LIMIT) bill = IND_FEE_PEAK; else if (peak_consumption >= IND_LIMIT) bill = consumption*IND_RATE_OFF + IND_FEE_OFF; } printf(" Account number: %d", account); printf(" Code: %c", code); printf(" Consumption: %d", consumption); printf(" Bill: %.2f", bill); }

PLEASE CONVERT THIS C++ CODE TO A PYTHON CODE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!