Class SleepingCar

java.lang.Object
  |
  +--Carriage
        |
        +--SleepingCar

class SleepingCar
extends Carriage

Class defines a sleeping car.

Version:
1.0
Author:
CS211 - Spring 2000

Field Summary
static int LOWER_BERTH
          Lower Berth type
static int MIDDLE_BERTH
          Middle Berth type
static int NO_OF_BERTHS_PER_COMPARTMENT
          Number of Berths in a compartment
static int NO_OF_COMPARTMENTS_PER_SLEEPING_CAR
          Number of compartments in a Sleeping Car
static int SLEEPING_CAR_TYPE
          Sleeping Car type
static int UPPER_BERTH
          Upper Berth type
 
Fields inherited from class Carriage
carriageNumber, carriagePlan, noOfColumns, noOfRows, noOfVacantPlaces
 
Constructor Summary
SleepingCar(int carriageNo)
          2a) Calls constructor of the superclass with carriage-number, etc.
 
Method Summary
 java.lang.String getNameOfTypePlace(int typePlace)
          2b) Defines the abstract method from the Carriage class.
 java.lang.String toString()
          2c) Overrides the method from the Object class.
 
Methods inherited from class Carriage
drawCarriagePlan, findRowNoOfFirstVacantPlace, getCarriageNo, hasVacantPlace, isFull, placePositionToPlaceNo, reserveFirstVacantPlace, setOccupied, typePlaceWithLeastOccupancy
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

SLEEPING_CAR_TYPE

public static final int SLEEPING_CAR_TYPE
Sleeping Car type

NO_OF_COMPARTMENTS_PER_SLEEPING_CAR

public static final int NO_OF_COMPARTMENTS_PER_SLEEPING_CAR
Number of compartments in a Sleeping Car

NO_OF_BERTHS_PER_COMPARTMENT

public static final int NO_OF_BERTHS_PER_COMPARTMENT
Number of Berths in a compartment

LOWER_BERTH

public static final int LOWER_BERTH
Lower Berth type

MIDDLE_BERTH

public static final int MIDDLE_BERTH
Middle Berth type

UPPER_BERTH

public static final int UPPER_BERTH
Upper Berth type
Constructor Detail

SleepingCar

public SleepingCar(int carriageNo)
2a) Calls constructor of the superclass with carriage-number, etc.
Method Detail

getNameOfTypePlace

public java.lang.String getNameOfTypePlace(int typePlace)
2b) Defines the abstract method from the Carriage class. Converts the type of place specified by column-number to place name.
Overrides:
getNameOfTypePlace in class Carriage

toString

public java.lang.String toString()
2c) Overrides the method from the Object class. Returns a string with indicates it is a sleeping car with a particular carriage number.
Overrides:
toString in class java.lang.Object