Question

USE C++ Hyde Park Electric Co. bills its customers on the basis of kilowatt hours (KWH)...

USE C++

Hyde Park Electric Co. bills its customers on the basis of kilowatt hours (KWH) used, as follows:
Kilowatt hours (KWH) used​​​Rate
1-100 7 cent per KWH
101-250 RM7.00 + 5 cents * KWH over 100
251-750 RM14.50 + 4 cents * KWH over 250
Over 750​​​​​RM34.50 + 3 cents * KWH over 750
The input will include each customer’s name, Account number and the number of kilowatt hours used (must be a positive value). The output should display the following for each customer: Name, Account number, kilowatt hours used and amount of the bill. *The program should be repeated if the user input is ‘Y’ or ‘y’.

Sample Output Display after the calculation:
Customer Name​​: Kate Loo
Account Number ​​: 12098765
KWH Used​​​: 320
Total Bill​​​: RM 17.3
Do you wish to continue​: Y
***Calculate the next customer bill if the user input is ‘Y’.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>

using namespace std;

float calcuate(float KWH)

{

float bill=0;

int diff;

  

if(KWH>0 && KWH<101)

{

bill=(7*KWH)/100;

}

else if(KWH>100 && KWH<251)

{

bill=7+(5*(KWH-100)/100);

}

else if(KWH>250 && KWH<751)

{

bill=14.50+((4*(KWH-250))/100);

}

else if(KWH>750)

{

bill=34.50+((3*((KWH-750)))/100);

}

return bill;

}

int main()

{

char name[20];

int account_number;

int KWH;

char ch='y';

while(ch=='y' || ch=='Y')

{

cout<<"Enter Customer Name: ";

cin.getline(name,20);

cout<<"Enter Account number :";

cin>>account_number;

cout<<"Enter KWH used: ";

cin>>KWH;

  

cout<<"***BILL***";

cout<<"\nCustomer Name"<<name;

cout<<"\nAccount number: "<<account_number;

cout<<"\nKWH used: "<<KWH;

  

float bill=calcuate(KWH);

cout<<"\nTotal Bill RM "<<bill;

cout<<"\nDo You wish To continue?";

cin>>ch;

}

return 0;

}

Add a comment
Know the answer?
Add Answer to:
USE C++ Hyde Park Electric Co. bills its customers on the basis of kilowatt hours (KWH)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The electric company charges according to the following rate schedule: 9 cents per kilowatt-hour (kwh) for...

    The electric company charges according to the following rate schedule: 9 cents per kilowatt-hour (kwh) for the first 300 kwh 8 cents per kwh for the next 300 kwh (up to 600 kwh) 6 cents per kwh for the next 400 kwh (up to 1000 kwh) 5 cents per kwh for all electricity used over 1000 kwh Write a program that would repeatedly read in a customer number (an integer) and the usage for that customer in kwh (an integer)....

  • Energy consumption is measured in units of kilowatt hours (kWh). The more kWh a household use...

    Energy consumption is measured in units of kilowatt hours (kWh). The more kWh a household use in a month, the higher the energy bill. A power company charges customers $0.12 per kWh for the first 500 kWh. After the first 500 kWh, the rate is $0.15 per kWh. Write a program to calculate energy charge. You must write and use the following two functions. (a) A main function: Ask the user to enter number of kWh used. Call the bill_calculator...

  • I submited this question before but they didnt follow the requirements/contraints or format...they didnt use methods....

    I submited this question before but they didnt follow the requirements/contraints or format...they didnt use methods. Please use comments. Write  a JAVA program that will ask for the customer’s last and current meter reading in Kilowatt Hours (KwHs). Determine the amount of usage for the month and calculate a subtotal (before tax) and a total amount due (tax included) using the following constraints. Constraints Rate A: For 500 KwHs or less = $0.0809 / KwH Rate B: For 501 to 900...

  • Use program control statements in the following exercises: Question 1 . Write pseudocode for the following:...

    Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...

  • This is a c++ program. Use the description from Parking Ticket Simulator (listed below) as a basis, where you need to...

    This is a c++ program. Use the description from Parking Ticket Simulator (listed below) as a basis, where you need to create a Car class and Police Officer class, to create a new simulation. Write a simulation program (refer to the Bank Teller example listed below) that simulates cars entering a parking lot, paying for parking, and leaving the parking lot. The officer will randomly appear to survey the cars in the lot to ensure that no cars are parked...

  • python question Question 1 Write a Python program to play two games. The program should be...

    python question Question 1 Write a Python program to play two games. The program should be menu driven and should use different functions to play each game. Call the file containing your program fun games.py. Your program should include the following functions: • function guess The Number which implements the number guessing game. This game is played against the computer and outputs the result of the game (win/lose) as well as number of guesses the user made to during the...

  • Assignment Overview This programming assignment is intended to demonstrate your knowledge of the following:  Writing...

    Assignment Overview This programming assignment is intended to demonstrate your knowledge of the following:  Writing a while loop  Writing a for loop  Writing a while loop with a sentinel value Chocolate Coupons Foothill Fro-cho, LLC, gives customers a coupon every time they purchase a chocolate bar. After they earn a certain number of coupons, they qualify for a free chocolate bar, which they may use toward the purchase of a single chocolate bar. Usually, 7 is the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT