1. Engineering
  2. Computer Science
  3. starting out with java a car with a 20gallon gas...

Question: starting out with java a car with a 20gallon gas...

Question details

Starting out with Java: A car with a 20-gallon gas tank averages 21.5 miles per gallon when driven in town and 26.8 miles per gallon when driven on the highway. Write a program that calculates and displays the distance the car can travel on one tank of gas when driven in town and when driven on the highway. Hint: The following formula can be used to calculate the distance: Distance = Number of Gallons X Average Miles per Gallon NOTE: You MUST use the JOptionPane class to display the output.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution