Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task # 5 Create a program from scratchIn this task the student will create a new program that calculates gas mileage in miles pergallon. The

Task #5 Create a program from scratchIn this task the student will create a new program that calculates gas mileage in miles pergallon. The student will use string expressions, assignment statements, input and outputstatements to communicate with the user.1. Create a new file in your IDE or text editor.2. Create the shell for your first program by entering:public class Mileage{public static void main(String[] args){// Add your declaration and code here.}}3. Save the file as Mileage.java.4. Translate the algorithm below into Java code. Dont forget to declare variablesbefore they are used. Each variable must be one word only (no spaces).Print a line indicating this program will calculate mileagePrint prompt to user asking for miles drivenRead in miles drivenPrint prompt to user asking for gallons usedRead in gallons usedCalculate miles per gallon by dividing miles driven by gallons usedPrint miles per gallon along with appropriate labels5. Compile the program and debug, repeating until it compiles successfully.6. Run the program and test it using the following sets of data and record the results:

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

More Books

Students also viewed these Databases questions