Programming Project 4.12 asked you to create a PizzaOrder class that stores an order consisting of up to three pizzas. Modify the class to store the pizzas using an array. This will allow the class to include an arbitrary number of pizzas in the order instead of a maximum of three. The setNumPizzas method can be used to create an array of the appropriate size. The array structure allows you to eliminate the methods setPizza1 , setPizza2 , and setPizza3 and replace them with a single method, setPizza(int index , Pizza newPizza ). Include appropriate tests to determine if the new PizzaOrder class is working correctly.
Modify the PizzaOrder class from Programming Project 4.12 from the text book.
Modified code:
private String size;
private int cheese;
private int pepperoni;
private int ham;
public Pizza(String size)
public Pizza(String size, int cheese,
int pepperoni, int ham)
public Pizza(Pizza aPizza)
public void setSize(String newSize)
public void setCheese(int newCheese)
public void setPepperoni(int newPepperoni)
public void setHam(int newHam)
public double calcCost()
public String getDescription()