|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Train
Defines a class for making place reservation on a train
Field Summary | |
private Carriage[] |
carriages
Array for carriages. |
private int |
currentIndex
Index of last carriage inserted in the train |
private Carriage |
currentSaloonCar
Current Saloon car for making a reservation |
private Carriage |
currentSleepingCar
Current Sleeping car for making a reservation |
Constructor Summary | |
Train(int maxNoOfCarriages)
3a) Constructs an array of carriages with maxNoOfCarriages and initializes all instance variables. |
Method Summary | |
private Carriage |
insertNewCarriage(Carriage thisCarriage)
3c) Insert a new carriage of the type specified by the parameter thisCarriage. |
private void |
placeReservation(Carriage currentCarriage,
int typePlace)
3d) Makes a reservation according to the criteria given in the text. |
void |
placeReservation(int carriageType,
int typePlace)
Makes the reservation in the appropriate carriage with the given type of place. |
void |
trainSummary()
3b) Prints out a summary for the train, consisting of: - number of saloon cars in the train. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private Carriage[] carriages
private int currentIndex
private Carriage currentSaloonCar
private Carriage currentSleepingCar
Constructor Detail |
public Train(int maxNoOfCarriages)
Method Detail |
public void trainSummary()
private Carriage insertNewCarriage(Carriage thisCarriage)
public void placeReservation(int carriageType, int typePlace)
private void placeReservation(Carriage currentCarriage, int typePlace)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |