Question: Write a program that asks the user to enter the number of hours for electric usage and calculates the charge according to the following: a

Write a program that asks the user to enter the number of hours for electric usage and calculates the charge according to the following:
a. Regular charge is $0.01/hour.
b. Charge for hours over 100 is $0.03/hour Declare charge as double. Make sure charge is formatted to two digits after the decimal point.
e.g. If usage is 50 hours, charge is 50 cents.
e.g. If usage is 100 hours, charge is $1.
e.g. If usage is 101 hours, charge is $1.03.
e.g. If usage is 107 hours, charge is $1.21
e.g.If usage is 150 hours, charge is $2.50.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!