o1.carsim
package o1.carsim
Type members
Classlikes
The class Car
represents virtual cars which can drive about on a surface.
A car has a fuel tank that contains gasoline, which is spent as the car moves
but can be added using an appropriate method.
The class Car
represents virtual cars which can drive about on a surface.
A car has a fuel tank that contains gasoline, which is spent as the car moves
but can be added using an appropriate method.
Although some aspects of a car object are immutable (e.g., fuel consumption rate), some others change (e.g., location, fuel).
- Value parameters:
- fuelConsumption
the fuel consumption of the new car in liters per 100 km
- tankSize
the size of the new car’s fuel tank, in liters
- initialFuel
the initial amount of fuel in the car’s tank, in liters (at most equal to tank size)
- initialLocation
the starting location of the car