Program 3 JAVA Class Implementation 100 Points + 25 Extra Credit DUE DATE: APRIL 9, 2015 Programming Project # 3 Page 247(4th e) Page 253(5th e) Write the program described in the textbook. Summary is as follows:
- Define a class Odometer that will be used to track fuel and mileage for an automobile.
- The class will have the following attributes:
- Instance variables to track the miles driven and fuel efficiency.
- Mutator methods to: a) Reset the odometer to zero miles. b) Set the fuel efficiency. This is in miles per gallon (mpg). c) Accept the miles driven for a trip and add it to the odometer total.
- Accessor method to return the number of gallons of gas that the vehicle has consumed since the odometer was last reset. The program plan outline should follow this structure: Class Odometer Public Variables Private Variables Set FuelEfficiency Miles Reset FuelEfficiency LogMiles GasConsumed INPUT/OUTPUT Hard code the mpg and miles travelled into the program. Example: Trip1 – FuelEfficiency(35) LogMiles(100) -> output GasConsumed “After 100 miles…” LogMiles(50) -> output GasConsumed “After another 50 miles…” Reset… Trip2 - FuelEfficiency(19) LogMiles(100) -> output GasConsumed “After 100 miles…” LogMiles(50) -> output GasConsumed “After another 50 miles…” EXTRA CREDIT 25 Points: Make the above program interactive to accept keyboard input with a menu of commands. IE: Enter the mpg, miles logged, reset, new trip, etc...