Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java program 2. Write a program that asks the user to enter the vehicle information, number of-miles-driven and gallons of gas used, then calculates the

Java program

image text in transcribed

2. Write a program that asks the user to enter the vehicle information, number of-miles-driven and gallons of gas used, then calculates the car's miles per gallor prints the result. The program also prints a message indicating whether or not the MPG is above, or below, or equal to the national average. The requirements are as follows a. Prompt the user to input the vehicle information, miles-driven and gallons-of.gas-used b. If the user input is invalid, print an error message calculate MPG c. Output the result including the vehicle information, mile-driven and gas-used d. If the MPS is more than 24, print a message indicating that it is above national average Otherwise, print a message indicating that it is equal to or below national average e. Use System.out.printf method to format the decimal places Sample Run: View as Page o search

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

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

What are the meanings of the terms markets and market niche?

Answered: 1 week ago