using the attached Pizza.h (below), You have open resources, but no consulting h
ID: 3676484 • Letter: U
Question
using the attached Pizza.h (below), You have open resources, but no consulting humans!! 1) Create .cpp file for Pizza.cpp 2) Create .cpp file for TestPizza.cpp – ask 3 users for orders; make the pizzas and print the orders. You do not need to create an array. 3) Upload your .cpp FILES to moodle as a .zip file (only 1 file allowed to be uploaded) NOTE: I will be using THIS Pizza.h file, so don't change it! A typical run might look like this: Please choose a pizza type:
1. plain
2. extra cheese
3. veggie
4. meat
5. veggie with extra cheese
7. meat and veggie
2. Please choose a pizza size: 6, 8, or 12 inch pizza 8 You ordered a extra cheese 8" pizza. The price of your pizza is $8.00. Making your pizza! Preparing extra cheese pizza. Baking pizza Cutting pizza Boxing pizza... ready to go! Thank you for your order. **************************************** Ate a pizza!
headerfile
#ifndef PIZZA_H
#define PIZZA_H
#include <string>
using namespace std;
class Pizza {
private:
const enum TYPES
{
PLAIN = 1,
EXTRA_CHEESE,
VEGGIE,
MEAT,
XCHEESE_VEG,
VEG_MEAT = 7
}; // types of pizza.
short size; // 6, 8, or 12 ONLY
int type; // uses enum TYPES
static int numPizzas; // keep track of pizzas
void prepare();// prints ìpreparing TYPE pizzaî (where TYPE is the type as a string not a number)
void bake();// prints ìbaking pizzaî
void cut();// prints ìcutting pizzaî
void box();// prints ìpackaging pizzaÖ Ready to go!î
public:
Pizza(short = 6, int = 1); // size, type
~Pizza(); // prints "Ate the pizza"
short getSize() const { return size; }
int getType() const { return type; }
void setSize(short);
void setType(short);
string getType(int); // NOTE!!! overload - return the string corresponding to the type if type is input
double getPrice(); // calc. price. formula: type * 2 + size/2
void make(); // make pizza by calling prepare, bake, cut and box
void printPizza();// print the order ñ type, size, price formatted nicely.
void printTypes();// print a list of pizza types so user can choose - use enum!
void printSizes();// print a list of pizza sizes so user can choose
};
#endif
Explanation / Answer
#include <iostream>
#include "Pizza.hh"
int main()
{
Pizza::Pizza pizza(Pizza::Margarita, Pizza::XL, 1);
std::cout << "Ingredient : " << pizza.getIngredient() << std::endl;
std::cout << "Time : " << pizza.getTimeCooking() << std::endl;
std::cout << "Length : " << pizza.getLength() << std::endl;
std::cout << "Type : " << pizza.getType() << std::endl;
return (0);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.