81 lines
1.3 KiB
Java
81 lines
1.3 KiB
Java
|
/**
|
||
|
This class represents a car.
|
||
|
@author
|
||
|
*/
|
||
|
public class Car {
|
||
|
|
||
|
/**
|
||
|
The model of the car (e.g. "Hyundai Accent").
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
The fuel efficiency of the car (in liters/100 km).
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
The amount of gas in the tank (in liters).
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
This method constructs a car with the specified model and fuel efficiency.
|
||
|
The gas tank is initially empty.
|
||
|
@param modelIn the model of the car.
|
||
|
@param fuelEfficiencyIn the fuel efficiency of the car (in liters/100 km).
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
This method retrieves the model of the car.
|
||
|
@return the model of the car.
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
This method retrieves the fuel efficiency of the car.
|
||
|
@return the fuel efficiency of the car (in liters/100 km).
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
This method retrieves the amount of gas in the tank.
|
||
|
@return the amount of gas in the tank (in litres).
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
This method drives the car for a certain distance, reducing the gas in the tank.
|
||
|
You may assume that the car will never consume more than the available gas
|
||
|
(you do NOT need to include a check for this in your solution).
|
||
|
@param distance the distance driven (in km).
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
This method adds gas to the tank.
|
||
|
@param gasAdded the volume of gas added to the tank (in liters).
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
} //end Car
|