Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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? 1 How many medium pizzas? 1 How many small pizzas? 1 What is your name? Captain America Type Constructor! Copy Constructor! Order 1: Captain America 1 Large Pizza(s) 1 Medium Pizza(s) 1 Small Pizza(s) Delivery: Yes Total Cost: $53.49 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. There should be private data members for the three different 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 invoke the three constructors successfully.

CPizza order1; // default constructor CPizza order2(2,1,3); // type constructor for // large, medium, and small pizza CPizza order3(order2); // copy constructo // 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 so it will build and run.

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

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

Students also viewed these Databases questions

Question

1.Which are projected Teaching aids in advance learning system?

Answered: 1 week ago