Question: Write a function, GasBill, that is given integer value for units used. The function will return a floating point value for the total cost. Your

 Write a function, GasBill, that is given integer value for unitsused. The function will return a floating point value for the total

Write a function, GasBill, that is given integer value for units used. The function will return a floating point value for the total cost. Your function will calculate a cost using the following conditions as the cost of the gas depends on how much is used. First 100 units are charged at $1.23 per unit, the next 100 units are $1.14 per unit, any units above 200 are charged at $1.08 per unit. For invalid parameter value, print "Incorrect input" and return For example: if 244 units were used, 100*1.23+100*1.14+44*1.08 would calculate the cost If only 87 units were used, the cost would be 87*1.23. For example Test cout

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 Databases Questions!