Class parkingLot

java.lang.Object
  |
  +--parkingLot

public class parkingLot
extends java.lang.Object

~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

capacity

public static final int capacity
Constant capacity provides the max capacity for all parking lot

See Also:
Constant Field Values

carCount_

protected int carCount_
Field carCount_ keeps track of the number of cars in a parking lot


name_

protected java.lang.String name_
Field name_ keeps track of the name of a parking lot

Constructor Detail

parkingLot

public parkingLot(java.lang.String n)
Construct a new ParkingLot with 0 cars and the name provided.

Method Detail

carCount

public int carCount()
Return current count of cars for parkingLot.


name

public java.lang.String name()
Return the name of the parkingLot.


enter

public void enter()
           throws parkingLot.parkingLotOverFlowException
increment car count by 1. If car count is already at capacity, this method throws parkingLotOverFlowException and car count does not change.

parkingLot.parkingLotOverFlowException

exit

public void exit()
          throws parkingLot.parkingLotUnderFlowException
decrement car count by 1. If car count is at zero, this method throws parkingLotUnderFlowException and car count stays the same.

parkingLot.parkingLotUnderFlowException