Question

The function should have a class name CPizza that will have three constructors (default, type, and copyl, public functions to use and implement are noted for you in the starter kit, and private member variables (all which are allocated dynamically). The private member variables include the three different sizes of pizza (Large, Medium, and Small), cost, a bool delivery, name, and delivery fee. The prices 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 majority of the functions can be implemented inline since they are simple and it would cut the amount of documentation for you as well. The few functions that you want to implement on a different file are the constructors and destructors, SetName, CalcCost, and DispOrder. Recall that CalcCost and DispOrder were already implemented in the previous HW assignment. Default Constructor will allocate space from the heap for all the member variables (except the name variable) and assign a value of 0 and/or false where applicable. The name variable will not allocate space from the heap, but instead assign a NULL to it. Type Constructor wil have an input of char pointer for the name, number of large pizza, number of medum izzas nur ber of smal·pizzas, cor, fee. These are all in that order and everything but the name should have a default assignment (0s for everything and false for delivery) Copy Constructor will create an exact copy of a CPizza object. Ivery, and en Destructor will delete all the space allocations for the private data members. SetLPizza will take as input an int to represent the number of large pizzas and assign it to the private data member. SetMPizza will take as input an int to represent the number of medium pizzas and assign it to the private data member. SetSPizza will take as input an int to represent the number of small pizzas anid assign it to the private data member SetDelivery will take as input a bool to represent whether the order will be delivered (true) or not (false) and assign it to the private data member SetDeliveryFee will take as input a double to represent the cost for delivery and assign it to the private data member SetName will take as input a char pointer and assign it to the private name dath member GetLPizza is a const function that will return the number of large pizzas GetMPizza is a const function that will return the number of medium pizzas GetSPizza is a const function that will return the number of small pizzas GetDelivery is a const function that will return the Boolean value if the order is to be delivered or not GetDeliveryFee is a const function that will return the cost for delivery GetName is a const function that will return the name as a char pointe GetTotal is a const function that will return the total cost of the order ett Pizza i n that will return the number of large pizzas 4:41 PM

media%2Ff0c%2Ff0c43b61-3b93-4c61-aeb8-ea

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
The function should have a class name CPizza that will have three constructors (default, type, and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • choices: supporting function default constructor friend function static member class getter setter attribute assignment operator Identify...

    choices: supporting function default constructor friend function static member class getter setter attribute assignment operator Identify the parts of the following class definition: class Student { string name; const int ID; float gpa; const char gender; public: Student(); Student& operator (const Student&); string getName() const {return name; } friend ostream& operator<<(ostream&, const Student); }; void outputStudent (const Student&); name [Choose Student) [Choose operator Choose) outputStudent Choose operator<< Choose) getNamel) [Choose

  • I need help implementing class string functions, any help would be appreciated, also any comments throughout...

    I need help implementing class string functions, any help would be appreciated, also any comments throughout would also be extremely helpful. Time.cpp file - #include "Time.h" #include <new> #include <string> #include <iostream> // The class name is Time. This defines a class for keeping time in hours, minutes, and AM/PM indicator. // You should create 3 private member variables for this class. An integer variable for the hours, // an integer variable for the minutes, and a char variable for...

  • Write a full class definition for a class named Player , and containing the following members: A data member name of t...

    Write a full class definition for a class named Player , and containing the following members: A data member name of type string . A data member score of type int . A member function called setName that accepts a parameter and assigns it to name . The function returns no value. A member function called setScore that accepts a parameter and assigns it to score . The function returns no value. A member function called getName that accepts no...

  • LW: Class Constructors Objectives Write a default constructor for a class. Note that this const...

    LW: Class Constructors Objectives Write a default constructor for a class. Note that this constructor is used to build the object anytime an argument is not provided when it is defined. Write a parameterized constructor that takes arguments that are used to initialize the class’s member variables Labwork Download the code associated with this lab: ColorConstructor.zip Main.cpp Color.h Color.cpp Compile and run the code. The first line of output of the program should display nonsensical integers for the values of...

  • Student ID: Student Name: private: string region Name; / The region's name int zip; Il The...

    Student ID: Student Name: private: string region Name; / The region's name int zip; Il The region's zip int population; Points to array of population for each year int num Years; /Number of years W Private member function to create an array of population. rray(int size) ( num Years size population- new int[size]; for (int i -0;i < size; i++) population[i]-DEFAULT POPULATION public: ll Constructor PopulationReport(string r, int z, int y) ( regionName r zip z createPopulationArray(y); J Il Please...

  • Create two classes and name their types HotdogStand and Money • All relevant classes, functions, and...

    Create two classes and name their types HotdogStand and Money • All relevant classes, functions, and data shall be placed in a namespace called MyAwesomeBusiness • Negative amounts of Money shall be stored by making both the dollars and cents negative • The Money class shall have four (4) constructors – A default constructor that initializes your Money object to $0.00 – A constructor that takes two integers, the first for the dollars and the second for the cents –...

  • Your will write a class named Gasket that can be used to build Gasket objects (that...

    Your will write a class named Gasket that can be used to build Gasket objects (that represent Sierpinski gaskets) that you can display graphically.  Your Gasket class is defined in the provided file Gasket.h.   DO NOT CHANGE the file Gasket.h.  The attributes and methods defined for class Gasket are described below.     ·sideLength            an int that holds the length of each side of the Gasket.  The length of the side is measured as a number of pixels ·xLocation              an int that holds the x coordinate (in pixels)...

  • Student class: Instance variables name id Constructors: Default constructor Constructor that has id and name passed...

    Student class: Instance variables name id Constructors: Default constructor Constructor that has id and name passed to the constructor Methods: Accessors int getID( ) String getName( ) Class Roster: This class will implement the functionality of all roster for school. Instance Variables a final int MAX_NUM representing the maximum number of students allowed on the roster an ArrayList storing students Constructors a default constructor should initialize the list to empty strings a single parameter constructor that takes an ArrayList<Student> Both...

  • Write a MyString class that stores a (null-terminated) char* and a length and implements all of...

    Write a MyString class that stores a (null-terminated) char* and a length and implements all of the member functions below. Default constructor: empty string const char* constructor: initializes data members appropriately Copy constructor: prints "Copy constructor" and endl in addition to making a copy Move constructor: prints "Move constructor" and endl in addition to moving data Copy assignment operator: prints "Copy assignment" and endl in addition to making a copy Move assignment operator: prints "Move assignment" and endl in addition...

  • Finish the class Matrix.h: class Matrix { public: Matrix(); //default constructor ~Matrix(); //destructor...

    Finish the class Matrix.h: class Matrix { public: Matrix(); //default constructor ~Matrix(); //destructor Matrix(const Matrix &); //copy constror Matrix(int row, int col); Matrix operator+(const Matrix &)const; //overload operator“+” Matrix& operator=(const Matrix &); //overload operator“=” Matrix transpose()const; //matrix transposition void display()const; //display the data private: int row; //row int col; //column int** mat; //to save the matrix }; //main.cpp #include <iostream> #include"Matrix.h" using namespace std; int main() { int row, col; cout << "input the row and the col for Matrix...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT