Question
We just reviewed about the three types of constructors. Your objective is to take 3 orders of pizza using the constructors. One order will invoke
We just reviewed about the three types of constructors. Your objective is to take 3 orders of pizza using the constructors. One order will invoke the default constructor, the other the type constructor, and lastly the copy constructor. Your code should mimic the output below.
$ ./a.out Default Constructor! Will this be for delivery (Y/N)? Y How many large pizzas? 2 How many medium pizzas? 1 How many small pizzas? 3 What is your name? Captain America Type Constructor! Copy Constructor! Order 1: Captain America 2 Large Pizza(s) 1 Medium Pizza(s) 3 Small Pizza(s) Delivery: Yes Total Cost: $96.59 Order 2: Clark Kent 2 Large Pizza(s) 1 Medium Pizza(s) 3 Small Pizza(s) Delivery: No Total Cost: $91.59 Order 3: Clark Kent 2 Large Pizza(s) 1 Medium Pizza(s) 3 Small Pizza(s) Delivery: No Total Cost: $91.59
The function should have a class name CPizza that will have 3 constructors (default, type, copy), any public function you feel is necessary (open ended), and private member variables. The private member variables are should have for the three difference sizes of pizza (Large, Medium, and Small), cost, a bool delivery, name, and delivery fee. The price of the pizzas are $20, $15, and $10 for large, medium, and small respectively. The cost should include the sales tax of 7.75% and a delivery fee if applicable. The delivery fee is $5 and remember it is nontaxable. The most important thing is to have main do the following code to successfully invoke the three constructors.
CPizza order1; // default constructor
CPizza order2(2,1,3); // type constructor for
// large, medium, and small pizza
CPizza order3(order2); // copy constructor
// prompt the user for order1 information
// display completed order
Get all three files (main.cpp, cpizza.h and cpizza.cpp) together in a multi-module project in HW20 directory so it will build and run. Let me know if you have any questions!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started