|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectproject4.Order
public class Order
Nested Class Summary | |
---|---|
class |
Order.NegativeOrderException
throw this exception when an order with a negative number is created |
Field Summary | |
---|---|
static int |
CHEESEBURGER_VALUE
the value of a cheeseburger in an order |
static int |
DELIVERED_ORDER_TYPE
delivered order type |
static int |
DINE_IN_ORDER_TYPE
dine-in order type |
static int |
FRIES_VALUE
the value of fries in an order |
static int |
HAMBURGER_VALUE
the value of a hamburger in an order |
static int |
TAKE_OUT_ORDER_TYPE
take-out order type |
Constructor Summary | |
---|---|
Order(int numHamburgers,
int numCheeseburgers,
int numFries)
standard constructor creates an order with some hamburgers, cheeseburgers, and french fries |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
overridden version of the equals method |
int |
getNumCheeseburgers()
accessor method to get the number of cheeseburgers in the order |
int |
getNumFries()
accessor method to get the number of fries in the order |
int |
getNumHamburgers()
accessor method to get the number of hamburgers in the order |
int |
getOrderValue()
compute and return the order's value |
void |
setNumCheeseburgers(int numCheeseburgers)
mutator method to set the number of cheeseburgers in the order |
void |
setNumFries(int numFries)
mutator method to set the number of fries in the order |
void |
setNumHamburgers(int numHamburgers)
mutator method to set the number of hamburgers in the order |
java.lang.String |
toString()
overridden version of the toString method |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int TAKE_OUT_ORDER_TYPE
public static final int DINE_IN_ORDER_TYPE
public static final int DELIVERED_ORDER_TYPE
public static final int HAMBURGER_VALUE
public static final int CHEESEBURGER_VALUE
public static final int FRIES_VALUE
Constructor Detail |
---|
public Order(int numHamburgers, int numCheeseburgers, int numFries) throws Order.NegativeOrderException
numHamburgers
- the number of hamburgers in the ordernumCheeseburgers
- the number of cheeseburgers in the ordernumFries
- the number of fries in the order
Order.NegativeOrderException
- thrown if any of the arguments are
negative valuesMethod Detail |
---|
public int getOrderValue()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
order
- the other order to compare against
public int getNumHamburgers()
public int getNumCheeseburgers()
public int getNumFries()
public void setNumHamburgers(int numHamburgers) throws Order.NegativeOrderException
numHamburgers
- the number of hamburgers for the order
Order.NegativeOrderException
- thrown if numHamburgers < 0public void setNumCheeseburgers(int numCheeseburgers) throws Order.NegativeOrderException
numCheeseburgers
- the number of cheeseburgers for the order
Order.NegativeOrderException
- thrown if numHamburgers < 0public void setNumFries(int numFries) throws Order.NegativeOrderException
numFries
- the number of fries for the order
Order.NegativeOrderException
- thrown if numHamburgers < 0
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |