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

27.99 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (1 vote)

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.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.