void setup() { System.out.println( "We're making pizzas" ); Pizza pepperoni = new Pizza(); Pizza cheese = new Pizza(); Pizza [] allThePizzas = new Pizza [10]; pepperoni.setSize( 14 ); pepperoni.size = 14; System.out.println( "Pepperoni is size: " + pepperoni.getSize() ); cheese.setSize( 20 ); System.out.println( "Cheese is size: " + cheese.getSize() ); String [] x = { "cheese" }; cheese.setToppings( x ); pepperoni.addTopping( "cheese" ); pepperoni.addTopping( "pepperoni" ); System.out.println( "Cheese has: " + cheese.printToppings() ); System.out.println( "Pepperoni has: " + pepperoni.printToppings() ); Customer c1 = new Customer( "Alfred", "201 Alfred Street" ); Customer c2 = new Customer( "Joshua" ); Customer c3 = new Customer( "Patricia" ); c1.order( pepperoni ); c1.order( cheese ); c1.order( pepperoni ); c1.order( pepperoni ); c1.order( pepperoni ); c1.order( pepperoni ); c1.order( pepperoni ); c1.order( pepperoni ); c1.order( pepperoni ); c1.order( pepperoni ); c1.order( pepperoni ); c2.order( cheese ); System.out.println( c1.printOrders() ); } public class Pizza { // Variables int size; String [] toppings; int numToppings; // Constructor public Pizza() { numToppings = 0; toppings = new String [1000]; } public int getSize() { return size; } public void setSize( int s ) { if( s < 8 || s > 36 ) { size = 10; System.out.println( "Error, pizza size invalid" ); } else { size = s; } } public String [] getToppings() { return toppings; } public void setToppings( String [] t ) { toppings = t; numToppings = t.length; } public void addTopping( String t ) { toppings[numToppings] = t; numToppings++; } public String printToppings() { String printString = ""; int count = 0; while( count < numToppings ) { printString += toppings[count] + " " ; count++; } return printString; } // end of printToppings } // end of Pizza class public class Customer { String name; String address; Pizza [] orderHistory; int numPizzas; public Customer( String n ) { name = n; orderHistory = new Pizza[9001]; numPizzas = 0; } public Customer( String n, String a ) { name = n; address = a; orderHistory = new Pizza[9001]; numPizzas = 0; } public void order( Pizza p ) { orderHistory[ numPizzas ] = p; numPizzas = numPizzas + 1; } public Pizza [] getOrders() { return orderHistory; } public String printOrders() { String ret = ""; int counter = 0; while( counter < numPizzas ) { Pizza temp = orderHistory[ counter ]; ret += temp.printToppings() + " | "; counter++; } return ret; } }