|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--parkingLot
~mohammad/public_html/classes/csc241/samples/parkingLot/parkingLot.java This is a simple parkingLot class; every ParkingLot object has a capacity of 100 cars and keeps track of its own name and how many cars are currently in it. A parkingLot object is constructed as empty, but willl be given its name. We have mutator methods that enable cars to enter/exit a parkingLot object; remember that we only keep track of how many cars are in a lot. We have an accessor method for the current car count as well as one for the name of the parking lot. The car count for a parkingLot need to be controlled so that it does not exceed capacity or fall below zero. This documentation was generated via javadoc.
Nested Class Summary | |
class |
parkingLot.parkingLotOverFlowException
An embedded exception class designed for handeling an illegal call to enter. |
class |
parkingLot.parkingLotUnderFlowException
An embedded exception class designed for handeling an illegal call to exit. |
Field Summary | |
static int |
capacity
Constant capacity provides the max capacity for all parking lot |
protected int |
carCount_
Field carCount_ keeps track of the number of cars in a parking lot |
protected java.lang.String |
name_
Field name_ keeps track of the name of a parking lot |
Constructor Summary | |
parkingLot(java.lang.String n)
Construct a new ParkingLot with 0 cars and the name provided. |
Method Summary | |
int |
carCount()
Return current count of cars for parkingLot. |
void |
enter()
increment car count by 1. |
void |
exit()
decrement car count by 1. |
java.lang.String |
name()
Return the name of the parkingLot. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int capacity
protected int carCount_
protected java.lang.String name_
Constructor Detail |
public parkingLot(java.lang.String n)
Method Detail |
public int carCount()
public java.lang.String name()
public void enter() throws parkingLot.parkingLotOverFlowException
parkingLot.parkingLotOverFlowException
public void exit() throws parkingLot.parkingLotUnderFlowException
parkingLot.parkingLotUnderFlowException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |