Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment First, launch IntelliJ and close any previous projects that may be open ( at the top menu go to File = = > Close
Assignment
First, launch IntelliJ and close any previous projects that may be open at the top menu go to File Close All Projects
Then create a new Java application called "FuelCalculation" without the quotation marks that will compute the the cost to travel miles and the distance that the car can travel with the gas currently in the tank.
Using a Scanner object, request the following three double values from the user after a userfriendly output statement or prompt for each:
Number of gallons of gas in the tank
Fuel efficiency of the car in miles per gallon
Price of gas per each gallon
Compute how far, in miles, the vehicle can travel on the available fuel. Your program should output:
You are able to travel XXX miles on remaining fuel.
where XXX is the miles distance you calculated.
Compute how much the cost would be for the gas to travel miles. Your program should output:
It will cost $XXXX to travel miles in the vehicle.
where XXXX is the cost to travel miles.
Notice the use of decimal places required in your program output: Use System.out.printfIt will cost $f to travel miles in the vehicle.
travelCost;
For this and all upcoming PA's involving user input, use a Scanner object to capture input. Do not use a command terminal prompt.
Be sure to use "valid" and "reasonable" data values for input.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started