Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 4: Gas Bil Write a program that calculates and prints out bills of the city gas company. The gas rates vary, depending on whether
Problem 4: Gas Bil Write a program that calculates and prints out bills of the city gas company. The gas rates vary, depending on whether the bill is for residential use, business use, or factory use. A code of r means residential use, a code of b means business use, and a code of f means factory use. Any other code should be treated as an error. The gas rates are computed as follows: Code r: Dh 5.00 plus Dh 0.005 per cubic centimeter. .Code b: Dh 1000.00 for the first 4000 cubic centimeter; Dh 0.0025 for each additional cubic centimeter. Code f: Dh 1000.00 if usage doesn't exceed 7000 cubic centimeter; Dh 2000.00 if usage is more than 7000 cubic centimeter but doesn't exceed 10000 cubic centimeter; Dh 3000.00 if usage exceeds 10000 cubic centimeter. Your program should prompt the user to enter the code (type char), and the cubic centimeters of gas used (type int). Your program should print the input data and the amount due. Sample input / output: nter the code and gas consumption:r 3500 he amount due is 22.5 Dh Enter the code and gas consumption: B 5500 The amount due is 1003.75 Dh Enter the code and gas consumption: F 12800 The amount due is 3000 Dh nter the code and gas consumption: k 5432 nvalid code!I
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started