Exercise #3
The Electric Bill
Write a complete C++ program to read from the keyboard two values: the number of kilowatt hours used (kwh) and the rate per kwh. The program should then compute an electric bill. The total bill is the usage cost (kilowatt hours used times rate) plus the monthly service fee (always $15.25) plus the state tax (4% of the usage cost). The program should use an informative prompt to obtain each input value. The program should display the kilowatt hours used, usage cost, state tax and the total amount owed with identifying phrases so that it looks like an invoice. You may display other values, such as the service fee or the rate, if you wish. Use consistent indentation, appropriate comments, and meaningful identifiers.
Here is a sample computation (this is only an example):
Suppose the kilowatt hours used is 589
(kwh is always a whole number) and the rate per kilowatt hour is $0.0535
(this often involves fractions of a cent), then the usage cost is $31.51,
the state tax is $1.26 and the total amount owed is $48.02
Note that when your program displays these values, they will probably include
fractions of cents. For example, the state tax actually comes out
to 1.26046. Don't worry about this, we will soon see how to format
these values so that only dollars and cents are displayed.
You will be working on this program with one other student. Produce a single source program in a file and using both team members' initials name it ex3-initials.cpp When your team is satisfied that the program works correctly and does the things highlighted above, copy the file to the folder:
Z:\jlwolfe\cosc110\secX\ex3\
where X is 1 or 2. If you do not
finish the program by the time class ends, copy what you have in the source
file to the appropriate folder. Accomplishing the highlighted tasks
above will be part of the grading of this exercise.