#include<iostream>
#include<string>
#include<vector>
usingnamespace std;
class MyPizza
{
private:
string name;
string size;
vector<string> toppings;
public:
void setSize(string);
string getSize();
void setName(string);
string getName();
string addTopping();
MyPizza()
{
name="";
size="";
toppings.push_back("");
}//default constructor
MyPizza(string Cname, string PizzaSize,vector<string> P_toppings) //parametized constructor
{
name=Cname;
size=PizzaSize;
toppings=P_toppings;
}
};
void MyPizza::setSize(string Psize)
{
size=Psize;
}
string MyPizza::getSize()
{
return size;
}
void MyPizza::setName(string Pname)
{
name=Pname;
}
string MyPizza::getName()
{
return name;
}
string MyPizza::addTopping()
{
string t;
for(int i=0;i<t.size();i++)
{
cout<<"What are the topping would you like";
cin>>t;
toppings.push_back(t);
cout<<t[i]<<endl;
}
return t;
// addTopping – this function receives a string representing a single topping, and adds it to
//to the vector of toppings in the class
}
int main()
{
MyPizza ob;
ob.addTopping();
}
/*Create a class called Pizza that represents a single pizza order. Required class attributes and
functions are as follows:
Class attributes:
Customer name (you can make it a single name if you want, no spaces)
Size of pizza (you decide whether to use string or char)
A VECTOR of strings that represents the toppings
Class Functions:
Default constructor (choose appropriate values)
set/get for size (validate that size is only S, M, L – upper or case)
set/get for customer name
addTopping – this function receives a string representing a single topping, and adds it to
to the vector of toppings in the class
clearTopping – this function resets the topping vector to empty (use .clear() function)
getPrice – this function calculates are returns the price of the pizza
display – this function displays the pizza order in the format shown below:
*/