Question
Need UML for this C++ code: main.cpp #include #include using namespace std; #include Pizza.h int main() { string size; int CheeseToppings; int PepperoniToppings; int HamToppings;
Need UML for this C++ code:
main.cpp
#include
#include
using namespace std;
#include "Pizza.h"
int main()
{
string size;
int CheeseToppings;
int PepperoniToppings;
int HamToppings;
cout << "Enter Pizza size: " << endl << endl << "Small, Medium or Large: ";
cin >> size;
cout << endl << "Enter Cheese Toppings Quantity: " << endl;
cin >> CheeseToppings;
cout << "Enter Pepperoni Toppings Quantity: " << endl;
cin >> PepperoniToppings;
cout << "Enter Ham Toppings Quantity: " << endl;
cin >> HamToppings;
Pizza x(size, CheeseToppings, PepperoniToppings, HamToppings);
cout << endl << "Total cost of your Pizza is: $" << x.calcost() << endl;
system("Pause");
return 0;
}
Pizza.cpp
#include
#include
using namespace std;
#include "Pizza.h"
Pizza::Pizza(string size, int CheeseToppings, int PepperoniToppings, int HamToppings)
{
this->size = size;
this->CheeseToppings = CheeseToppings;
this->PepperoniToppings = PepperoniToppings;
this->HamToppings = HamToppings;
}
string Pizza::getSize()
{
return size;
}
void Pizza::setSize(string size)
{
this->size = size;
}
int Pizza::getCheeseToppings()
{
return CheeseToppings;
}
void Pizza::setCheeseToppings(int CheeseToppings)
{
this->CheeseToppings = CheeseToppings;
}
int Pizza::getPepperoniToppings()
{
return PepperoniToppings;
}
void Pizza::setPepperoniToppings(int PepperoniToppings)
{
this->PepperoniToppings = PepperoniToppings;
}
int Pizza::getHamToppings()
{
return HamToppings;
}
void Pizza::setHamToppings(int HamToppings)
{
this->HamToppings = HamToppings;
}
double Pizza::calcost()
{
double cost;
if (size.compare("Small") == 0)
{
cost = 10 + (CheeseToppings + PepperoniToppings + HamToppings) * 2;
}
else if (size.compare("Medium") == 0)
{
cost = 12 + (CheeseToppings + PepperoniToppings + HamToppings) * 2;
}
else if (size.compare("Large") == 0)
{
cost = 14 + (CheeseToppings + PepperoniToppings + HamToppings) * 2;
}
return cost;
}
Pizza.h
#ifndef PIZZA_H
#define PIZZA_H
class Pizza
{
public:
//Function declarations
Pizza(string size, int CheeseToppings, int PepperoniToppings, int HamToppings);
string getSize();
void setSize(string size);
int getCheeseToppings();
void setCheeseToppings(int cheeseToppings);
int getPepperoniToppings();
void setPepperoniToppings(int PepperoniToppings);
int getHamToppings();
void setHamToppings(int HamToppings);
double calcost();
private:
//Declaring variables
string size;
int CheeseToppings;
int PepperoniToppings;
int HamToppings;
};
#endif
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