|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorderprocessing.OrderItem
This class contains information about a single item on a customer order. Note that this class implements the Immutable Object design pattern.
These are used for both orders and invoices.
Constructor Summary | |
OrderItem(int quantity,
long itemNumber,
double unitPrice,
java.lang.String description)
Create an order item for a given quantity of a certain item |
Method Summary | |
java.lang.Object |
clone()
|
java.lang.String |
description()
Retrieve the description of the item in this order item |
void |
display()
Display this order item on standard out |
void |
displayExtended()
Display the order item along with its extended price on standard out. |
boolean |
equals(java.lang.Object o)
|
double |
extendedPrice()
Retrieve the extended price (unit price times quantity) for this order item |
static OrderItem |
genOrderItem(java.lang.String orderItem,
java.lang.String sep)
Generate a new order item from a correctly formatted string. |
int |
hashCode()
|
long |
itemNumber()
Retrieve the item number for this order item |
int |
quantity()
Retrieve the quantity for this order item |
java.lang.String |
toString()
|
double |
unitPrice()
Retrieve the unit price of this item |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public OrderItem(int quantity, long itemNumber, double unitPrice, java.lang.String description)
quantity
- The quantity ordered.itemNumber
- The item desired.unitPrice
- The price per unit for this item.description
- - Item descriptionMethod Detail |
public int quantity()
public long itemNumber()
public double unitPrice()
public double extendedPrice()
public java.lang.String description()
public boolean equals(java.lang.Object o)
public int hashCode()
public void display()
public void displayExtended()
public java.lang.Object clone()
public java.lang.String toString()
public static OrderItem genOrderItem(java.lang.String orderItem, java.lang.String sep)
orderItem
- the string describing the order itemsep
- the separator character(s) used in the description string
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |