Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. PizzaOrder Class Create a class named PizzaOrder that store information about an order of potentially multiple pizzas. It should contain the following: A private

1. PizzaOrder Class Create a class named PizzaOrder that store information about an order of potentially multiple pizzas. It should contain the following: A private instance variable, order, which is an array of base type Pizza. Each pizza saved in this array should be a Pizza object as described in the specs for Assignment 5. A private instance variable, numPizzas, which tells how many Pizzas are in the order Two constructors: o A no-arg constructor which defaults to an order of a single small, cheese Pizza. o A constructor that takes an integer parameter that tells how many pizzas will be added to the order and initializes the order instance variable to an empty array of that size. In addition to the constructors, provide the following methods: o public void addPizza(Pizza pizza)add the parameter Pizza object to the PizzaOrders order member variable. Given that the order is saved as a Pizza array, remember that once the order is full you will not be able to add more pizzas! Implement this method to indicate that adding the additional pizza was unsuccessful. The program should not crash/exit. o public double calcTotal()returns the total cost of the order by adding up the prices of each pizza in the order (hint: use the calcCost method from the Pizza class for each Pizza object in the order array) o public String toString()returns a String representing this order, so that the employee at the pizza joint can repeat the order back to you before sending it to the kitchen. This method should begin by calling the calcTotal() method so that the total price of the order can be displayed.

I need help on this please

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions