Write a program that calculate electricity bill. The program prompts the user to enter the amount of KWh units of electricity consumed, the task is to calculate the electricity bill total with the help of the below charges: • 1 to 50 units of total units-Unit price-10 • 50 to 100 units of total units- Unit price-15 above 100 units - Unit price=20

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter4: Control Structures I (selection)
Section: Chapter Questions
Problem 20PE: The cost of renting a room at a hotel is, say $100.00 per night. For special occasions, such as a...
icon
Related questions
Question
Write a program that calculate electricity bill. The program prompts the user to enter the amount of KWh units of
electricity consumed, the task is to calculate the electricity bill total with the help of the below charges:
• 1 to 50 units of total units - Unit price=10
• 50 to 100 units of total units - Unit price=15
• above 100 units - Unit price=20
Sample Runl:
Enter the amount of KWh units U: 250
Total Bill: 4250
Explanation:
Charge for the first 50 units - 10 50 500
Charge for the 50 to 100 units - 15 50 - 750
Charge for the 100 to 250 units - 20*150 - 3000
Sample Run2:
Enter the amount of KWh units U: 95
Total Bill: 1175
Explanation:
Charge for the first 100 units - 10*50 - 500
Charge for the 50 to 100 units - 15 45 675
Transcribed Image Text:Write a program that calculate electricity bill. The program prompts the user to enter the amount of KWh units of electricity consumed, the task is to calculate the electricity bill total with the help of the below charges: • 1 to 50 units of total units - Unit price=10 • 50 to 100 units of total units - Unit price=15 • above 100 units - Unit price=20 Sample Runl: Enter the amount of KWh units U: 250 Total Bill: 4250 Explanation: Charge for the first 50 units - 10 50 500 Charge for the 50 to 100 units - 15 50 - 750 Charge for the 100 to 250 units - 20*150 - 3000 Sample Run2: Enter the amount of KWh units U: 95 Total Bill: 1175 Explanation: Charge for the first 100 units - 10*50 - 500 Charge for the 50 to 100 units - 15 45 675
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning