Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a program that will calculate and print bills for the city electric power company The rates vary depending on whether the use is

image text in transcribed

1. Write a program that will calculate and print bills for the city electric power company The rates vary depending on whether the use is residential (R), commercial (C) or industrial (T). The rates are computed as follows Residential: $6.00 flat fee plus S0.052 per kwh used Commercial: $60.00 flat fee for the first 1000 kwh (or amount less than 1000 kwh) used and S0.045 for each additional kwh above 1000 Industrial: $76.00 flat fee for the first 500 kwh (or amount less than 500 kwh) and S0.065 for each additional kwh above 500 Your program should prompt the user to enter the number of kilowatt-hours of energy consumed and the type of use (entered as a single character), and should calculate and display the amount of the charge due from the customer with two decimal digits. Use a switch statement to handle the different types of usage. The program should allow for entry of either upper or lower case usage characters and should include an error message for entry of an invalid code character. Print the quantity calculated with 2 decimal digits. When the program is working, modify it using a while or do...while loop so that the program will continue prompting the user to see if another bill is to be calculated. For example, suppose that a number of kwh is entered and the user specifies that the usage rate is for residential use. After the result is printed the user will be asked if he wants to do another calculation. He might enter Y to continue or N to quit. Include entry of the kwh as well as the switch statement in the loop Test your program for each type of usage with a value of 1500 kwh

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

Students also viewed these Databases questions

Question

3. Job rotation is used for all levels and types of employees.

Answered: 1 week ago