Lab 2: the Car class
Create a Car class that stores gas left (as a double) in liters,
distance travelled (as an int) in kilometers,
and efficiency (as a double) in kilometers/liter.
Gas left and distance travelled starts at 0,
efficiency starts at 10 kilometers/liter.
Support the following methods:
- void loadGas( double liters )
- void drive( int km )
- double getGasLeft()
- int getOdometerReading()
optional:
- void changeEfficiency( double eff )
- void drainGas()
- void resetOdometer()
Write this program in BlueJ and test
the class by creating objects and running methods
on that object.
Zip your BlueJ project and submit through
moodle .