Programming Project 4.12 asked you to create a Pizza Order class that stores an order consisting of up to three pizzas. Extend this class with the following methods and constructor:
• public int getNumPizzas()—returns the number of pizzas in the order.
•public Pizza getPizzal()—returns the first pizza in the order or null if pizzal is not set.
•public Pizza getPizza2()—returns the second pizza in the order or null if pizza2 is not set.
•public Pizza getPizza3()—returns the third pizza in the order or null if pizza3 is not set.
•A copy constructor that takes another Pizza Order object and makes an independent copy of its pizzas. This might be useful if using an old order as a starting point for a new order.
Write a main method to test the new methods. Changing the pizzas in the new order shouldn’t change the pizzas in the original order. For example:
Pizza pizzal =//Code to create a large pizza, 1 cheese, 1 Pizza pizza2 =//Code to create a medium pizza, 2 cheese, 2 PizzaOrder order1 =//Code to create an order order1.setNumPizzas(2);//2 pizzas in the orderOrder1.setPizzal(pizzal);//Set first pizzaOrder1.setPizza2(pizza2);//Set second pizzadouble total = order1.calcTotal();//Should be 18+20 = 38Pizza0rder order2 = new PizzaOrder(order1);//Use copy constructor order2.getPizzal().setNumCheeseToppings(3);//Change toppings double total = order2. CalcTotal() ;//Should be 22 + 20 = 44double origTotal = order1.calcTotal();//Should still be 38
Note that the first three lines of code are incomplete. You must complete them as part of the Programming Project.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.