Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ Define a class called Pizza that has member variables to track the type of pizza (either deep dish, hand tossed, or pan) along

In C++

Define a class called Pizza that has member variables to track the type of pizza (either deep dish, hand tossed, or pan) along with the size (either small, medium, or large) and the number of pepperoni and cheese toppings. You can use constants to represent the type and size. Your class will have four member variables: size, type, pepperoniToppings, cheeseToppings. Include mutator and accessor functions for your class. Create a void function, outputDescription(), that outputs a textual description of the pizza object. Also include a function, computePrice(), that computes the cost of the pizza and returns it as a double according to the rules:

Small pizza = $10 + $2 per topping Medium pizza = $14 + $2 per topping Large pizza = $17 + $2 per topping 

Sample output:

This pizza is: Small, Hand tossed, with 0 pepperoni toppings and 3 cheese toppings. Price of cheesy: 16 This pizza is: Large, Pan, with 2 pepperoni toppings and 1 cheese toppings. Price of pepperoni : 23 

image text in transcribed

1 #include kiostream 2 using namespace std; 4 const int SMALL o; 5 const int MEDIUM 1; 6 const int LARGE 2; 8 const int DEEPDISH 0; 9 const int HANDTOSSED 1 10 const int PAN 12 int main 13 E 14 Pizza cheesy; 15 Pizza pepperoni; 16 17 cheesy. setChe Toppings (3) ee8e 18 cheesy setType (HANDTOSSED) 19 cheesy output Description 20 cout Price of cheesy cheesy.computePrice endl 21 22 pepperoni. setSize (LARGE) 23 pepperoni. set PepperoniToppings (2) 23 pepperoni. setType (PAN) 25 pepperoni. output Description 26 cout Price of pepperoni. pepperoni. .compute Price endl 27 28

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

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago