Class PersonalCar

java.lang.Object
  extended by PersonalCar
All Implemented Interfaces:
Car

public class PersonalCar
extends java.lang.Object
implements Car

Write a description of class PersonalCar here.


Constructor Summary
PersonalCar(java.lang.String type, int maxPersons, int persons)
          Constructor for objects of class PersonalCar
 
Method Summary
 int load(int cargo)
          Loads the amount of a cargo/persons
 void refuel(int fuel)
          Refuels the car
 void run(int distance)
          Runs the distance suplied as a parameter
 java.lang.String toString()
          Returns String representation of the particular object.
 int unload(int cargo)
          Unloads the amount of cargo/persons, if available, else fully unloads the car.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PersonalCar

public PersonalCar(java.lang.String type,
                   int maxPersons,
                   int persons)
Constructor for objects of class PersonalCar

Parameters:
type - car type
maxPersons - maximum number of allowed persons
persons - persons to be initiali loaded. When persons > maxPersons only maxPersons will be loaded.
Method Detail

toString

public java.lang.String toString()
Returns String representation of the particular object.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the object in the form: "<type> (<maxPersons>): <persons> persons \tfuel: <fuel>\n"

unload

public int unload(int cargo)
Description copied from interface: Car
Unloads the amount of cargo/persons, if available, else fully unloads the car.

Specified by:
unload in interface Car
Parameters:
cargo - amount of a cargo/persons
Returns:
amount of unloaded cargo/persons

load

public int load(int cargo)
Description copied from interface: Car
Loads the amount of a cargo/persons

Specified by:
load in interface Car
Parameters:
cargo - amount of a cargo/persons
Returns:
amount of really loaded cargo/persons

refuel

public void refuel(int fuel)
Description copied from interface: Car
Refuels the car

Specified by:
refuel in interface Car

run

public void run(int distance)
Description copied from interface: Car
Runs the distance suplied as a parameter

Specified by:
run in interface Car
Parameters:
distance - distance to be ran