Starting from:

$23

A class named Odometer that will be used to track fuel and mileage for an automobile.

NOTE: ENTER YOUR UDIL ID ON THE PACKAGE (edu.iltu.itk275.assignment4.yourUDIL) All of the java classes should be placed in a package named edu.iltu.itk275.assignment4.. The class should be submitted as an attachment to this assignment. They may be submitted individually or placed into a single archive (.zip) file. Define a class named Odometer that will be used to track fuel and mileage for an automobile. The class should have instance variables to track the miles driven and the fuel efficiency of the vehicle in miles per gallon. Include a mutator method to reset the Odometer to zero miles, a mutator method to set the fuel efficiency, a mutator method that accepts miles driven for a trip and adds it to the odomoter’s total, and an accessor method that returns the number of gallons of gasoline that the vehicle has consumed since the odometer was last reset. Use your class with a test application named OdometerTest that creates several trips with different fuel efficiencies. You should decide which Odometer attributes should be public, if any.

More products