[Solved]Java Assignment Use Class Car Represent Car Travels Various Destinations Car Fuel Economy Q37286483
In JAVA
In this assignment you will use a class Car to represent acar that travels to various destinations. Your car has afuel economy rating of 32.3 miles per gallon. The gas tank holds19.5 gallons. Your program will need to simulate two trips: 1) BCto Yosemite Valley, and 2) BC to Washington, D.C.. For each tripyou will start with a full tank of gas. The output should look asfollows.
Trip one: Bakersfield College to Dodger Stadium
Mileage: 204
Trip two: Bakersfield College to Washington, D.C.
Mileage: 2,686
The constructor will set the fuel efficiency rating to 32.3 mpgand the initial fuel level for each trip to zero.
Write a method addGas(), to fill the fuel tank.
Write a method getGasInTank(), returning the current amount ofgasoline in the fuel tank.
Write a method named roadTrip() that simulates driving the car agiven distance, reducing the
amount of gasoline in the fuel tank.
Let the user know they ran out of gas if they try to drive furtherthan the fuel in the tank and the mileage allows. The output mustshow the mileage at which they would be where they run out of gas.Use int for mileage and discard any fractional values resultingfrom division.
All values must be hard-coded, do not use the Scannerclass.
In this assignment you will use a class Car to represent a car that travels to various destinations. Your car has a fuel economy rating of 32.3 miles per gallon. The gas tank holds 19.5 gallons. Your program will need to simulate two trips: 1) BC to Yosemite Valley, and 2) BC to Washington, D.C. For each trip you will start with a full tank of gas. The output should look as follows. Trip one: Bakersfield College to Dodger Stadium Mileage: 204 Trip two: Bakersfield College to Washington, D.C Mileage: 2,686 The constructor will set the fuel efficiency rating to 32.3 mpg and the initial fuel level for each trip to zero. Write a method addGas(), to fill the fuel tank. Write a method getGaslnTank), returning the current amount of gasoline in the fuel tank. Write a method named roadTrip) that simulates driving the car a given distance, reducing the amount of gasoline in the fuel tank. Let the user know they ran out of gas if they try to drive further than the fuel in the tank and the mileage allows. The output must show the mileage at which they would be where they run out of gas. Use int for mileage and discard any fractional values resulting from division. All values must be hard-coded, do not use the Scanner class a text file with the java extension. Submit the java files, do not submit the class files. Be sure the class Carjava names match your file names, e.g. if your class is named Car the file name should be Show transcribed image text In this assignment you will use a class Car to represent a car that travels to various destinations. Your car has a fuel economy rating of 32.3 miles per gallon. The gas tank holds 19.5 gallons. Your program will need to simulate two trips: 1) BC to Yosemite Valley, and 2) BC to Washington, D.C. For each trip you will start with a full tank of gas. The output should look as follows. Trip one: Bakersfield College to Dodger Stadium Mileage: 204 Trip two: Bakersfield College to Washington, D.C Mileage: 2,686 The constructor will set the fuel efficiency rating to 32.3 mpg and the initial fuel level for each trip to zero. Write a method addGas(), to fill the fuel tank. Write a method getGaslnTank), returning the current amount of gasoline in the fuel tank. Write a method named roadTrip) that simulates driving the car a given distance, reducing the amount of gasoline in the fuel tank. Let the user know they ran out of gas if they try to drive further than the fuel in the tank and the mileage allows. The output must show the mileage at which they would be where they run out of gas. Use int for mileage and discard any fractional values resulting from division. All values must be hard-coded, do not use the Scanner class a text file with the java extension. Submit the java files, do not submit the class files. Be sure the class Carjava names match your file names, e.g. if your class is named Car the file name should be
Expert Answer
Answer to In JAVA In this assignment you will use a class Car to represent a car that travels to various destinations. Your car h… . . .
OR

