Question: Using a Scanner object, request the following three double values from the user after a user - friendly output statement or prompt for each: Number

Using a Scanner object, request the following three double values from the user after a user-friendly 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 X.XX miles on remaining fuel.
where X.XX is the miles distance you calculated.
Compute how much the cost would be for the gas to travel 50 miles. Your program should output:
It will cost $XX.XX to travel 50 miles in the vehicle.
where XX.XX is the cost to travel 50 miles.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!