Question: Program 1 Write an interactive C + + program that calculates the cost to fill up a person's car gas tank based on whether the

Program 1
Write an interactive C++ program that calculates the cost to fill up a person's car gas tank based on whether the person wants regular, plus, or supreme gasoline. Assume the person's gas tank is completely empty. The program should accept as input the number of gallons of gasoline the car's tank holds, and a single letter (\(\mathrm{R},\mathrm{P}\), or S ) that indicates if the person needs regular, plus, or supreme gasoline. The program should work for both uppercased and lowercase letters.
If the person wants regular gasoline, the price of gas is \(\$ 2.09\) per gallon.
If the person wants plus gasoline, the price of gas is \(\$ 2.29\) per gallon.
If the person wants supreme gasoline, the price of gas is \(\$ 2.69\) per gallon.
The program should print the cost to fill up the car's gas tank based on the type of gas selected. Print all monetary amounts to two decimal places.
Program 1 Write an interactive C + + program that

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!