dbrown
Class Order

java.lang.Object
  extended by dbrown.Order

 class Order
extends java.lang.Object

A simple class representing restaurant orders that tracks how many objects have been instantiated from it and whether the maximum number of objects allowed have been created.

Version:
2005-11-09
Author:
David B. Brown from Bruce Eckel

Field Summary
private static int count
          Tracks the total number of orders placed.
private  int number
          The number of a particular order.
private static int ORDERS
          The maximum number of orders tha can be placed.
 
Constructor Summary
Order()
          The Order constructor.
 
Method Summary
 int getNumber()
           
 boolean isLastOrder()
          Determines whether an order is the last order.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

count

private static int count
Tracks the total number of orders placed.


ORDERS

private static final int ORDERS
The maximum number of orders tha can be placed.

See Also:
Constant Field Values

number

private int number
The number of a particular order. This number can be accessed using the getter getNumber, but cannot be set.

Constructor Detail

Order

public Order()
The Order constructor.

Method Detail

getNumber

public int getNumber()
Returns:
Returns the order number.

isLastOrder

public boolean isLastOrder()
Determines whether an order is the last order.

Returns:
whether this is the last order or not.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object