Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

Wrote a java program that does the following image text in transcribed
image text in transcribed
(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions