Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ pls .11 VZW Wi-Fi 8:00 PM 54% CS52-Assignment05.pdf Problem 2 Pizza 15 points Implement a program that creates pizzas based on user order. First,

C++ pls image text in transcribed
image text in transcribed
.11 VZW Wi-Fi 8:00 PM 54% CS52-Assignment05.pdf Problem 2 Pizza 15 points Implement a program that creates pizzas based on user order. First, create class called Ingredient with one instance variable description of type string which is set in the constructor and can be get using a getter function. Create the following classes that derive from Ingredient TomateSauce, Cheese, Dough, and Pepperoni, each with a constructor that passes the description argument to the base constructor. Use proper access modifiers! Santa Monica College CS 52-C+ Programming Create a class Pizza which consists of a dynamically allocated array of Ingredient object pointers (Ingredient* ingredients:). The constructor expects the number of maximum ingredients as int which is used to dynamically allocate and initialize the array. Implement a destructor that deletes the Ingredient objects and the array. The class has a function void add(Ingredientingredient) which adds an ingredient to the pizza and a function to print its ingredients to the console. Create an abstract class PizzaFactory with a pure virtual function called bake0 that returns a Pizza object pointer. Create the two subclasses CheesePizzaFactory and PepperoniPizzaFactory which both explicitly override the bake) function. Both functions should remain virtual. The CheesePizzaFactory instantiates Pizza and adds Dough TomatoSauce, and Cheese to it. The PepperoniPizzaFactory creates a pizza and adds all ingredients including pepperoni to it. Use the following main method which prompts a user to order a type of pizza and then instantiates the corresponding PizzaFactory for it. After the pizza is created by calling the bake) function, the ingredients of the pizza are printed by calling the listiegredientsO function of the pizza object. Finally, the factory and the pizza objects are deleted. int main0 char choice: cout e

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

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions