Question: Wrote a java program that does the following (20 points) A gas station sells three different grades of gasoline. The retail prices are shown below.
(20 points) A gas station sells three different grades of gasoline. The retail prices are shown below. 4. Price per Gallon $2.45 $2.89 $3.09 Gas Grade Type 87 89 93 Regular Plus Premium Write a program that asks the user to enter th outputs the price before tax. The program should be menu driven, giving the user various choices: 87- Regular 89 Plus 93-Premium 0 Exit You should use a flag-controlled or a sentinel-controlled while loop so that the program can get a series of sales data until the user enters 0. Inside the loop, a switch structure is used to help selecting a gasoline grade and displaying the price for each sale. Your program should also calculate and display the total value of each grade of gas sold, and calculate and display the total value of all sales. The results should be formatted appropriately. Here is a sample input/output dialog: Welcome to "Your Friendly Gas Station" Enter the gas number 87, 89, or 93 to start or 0 to exit. 87 Regular $2.45 89 Plus 93Premium $3.09 0 Exit $2.89 Select a number: 87
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
