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...

  • Write a program in c++ for An electric company came out with a residential rate schedule...

    Write a program in c++ for An electric company came out with a residential rate schedule in your state. You are asked to write a program that will compute the customer’s electric bill. Program will prompt month number and Kilowatt hour used. Sample Input Screen:             Enter the month (1 - 12)                      :             Kilowatt hours used                             : The electric bill is computed using the following method: There is a flat service charge of $15.31...

  • 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...

  • Write a complete C++ program that creates a monthly bill for the text messaging. Your cell...

    Write a complete C++ program that creates a monthly bill for the text messaging. Your cell phone company provides the following three text messaging plans. Package A: Two Thumbs.   For $9.95 per month, 100 text messages are allowed. Additional text messages are 15 cents each. Package B: All Thumbs. For $14.95 per month, 200 text messages are allowed. Additional text messages are 10 cents each. Package C: Lightning Thumbs. For $19.95 per month, unlimited text messaging is provided. State sales...

  • This is a C++ program Instructions Design a class named PersonData with the following member variables...

    This is a C++ program Instructions Design a class named PersonData with the following member variables declared as strings: lastName firstName address city state zip phone Create 3 constructors; a default constructor, a constructor that accepts the first and last name member variables, and a constructor that accepts all member variables. Write the appropriate accessor/getter and mutator/setter functions for these member variables. Create a method within this class called getFullName() that returns the person's first and last names as a...

  • 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...

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