Question: C++ Write a program that calculates a gas bill. It inputs an integer value for the total number of units used, and prints the total
C++

Write a program that calculates a gas bill. It inputs an integer value for the total number of units used, and prints the total cost. Your program will calculate the cost using the following conditions: First 100 units are charged at $1.23 per unit. The next 100 units are $1.14 per unit. Units above 200 are charged at $1.08 per unit. If the input value is negative, it should print "Incorrect input". For example: 1. If 244 units were used, 100*1.23 + 100*1.14 +44*1.08 would be the total cost. 2. If only 87 units were used, the total cost would be 87*1.23. For example: Test Input Result // test 123 Enter unites used: Total cost: 149.22
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
