Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a c program for the above question 1. Write a program that will calculate and print bills for the city electric power company. The

image text in transcribed

write a c program for the above question

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 (I). 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

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions

Question

Show that at E = EF, the Fermi factor is F = 0.5.

Answered: 1 week ago

Question

=+Do aesthetics aid in understanding and usage? .

Answered: 1 week ago

Question

Does it use a maximum of two typefaces or fonts?

Answered: 1 week ago