Question: Write an interface named electricity Bill that will calculate and print bills for the city power company. The rates vary depending on whether the

Write an interface named electricity Bill that will calculate and print bills for the city power company. The

Write an interface named electricity Bill 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 wwwwwww 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. Note that if the code is I, an additional input to determine whether it is peak or off peak is required. The interface should display the amount due from the user, rounded to 2 decimal points. Example usage of the interface should be looks like this (example shown in PHP): electricity Bill bill = new electricity Bill(); bill->code('R') bill->amountOfElectricity (50) bill->amountDue(); // output RM 8.60 bill->code('C') bill->amountOfElectricity (800) bill->amountDue(); // output RM 60.00 Your task is to implement an electricity billing system that fulfills the requirements described above.

Step by Step Solution

3.38 Rating (145 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Creating an electricity billing system involves setting up an interface and implementing its functionality Below is an example of how this can be done ... View full answer

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 Programming Questions!