#include <iostream>
#include <cstdlib>
#include <cstring>
#include <array>
using namespace std;
// I Jaime Krogen verify that all of the work below is my own.
// Inventory: Global Varibales
// Toppings
int cheese = 200;
int pepperoni = 100;
int mushroom = 100;
int onions = 100;
int sausage = 100;
int hamburger = 100;
int baconBits = 100;
int blackOlives = 100;
int greenPeppers = 100;
int pineapple = 50;
//crust types
int thinCrust = 100;
int flatBread = 100;
int thickCrust = 100;
// Bussiness data
double totalRevenue = 0;
double totalOrderCost = 0;
double totalPizzaCost = 0;
int crustCost = 0;
int sizeCost = 0;
int mushroomCost = 0;
int onionsCost = 0;
int baconBitsCost = 0;
int pineappleCost = 0;
// PROBLEM CHILDren so made global
int orderNumSize = 0;
int guestSize = 0;
int numberOfPizzas = 0;
// Function displays size of pizza and updates revenue.
void PizzaSize(int numSize, int& sizeCost) {
switch(numSize){
case 1:
cout << "personal pan";
sizeCost = 10;
break;
case 2:
cout << "small";
sizeCost = 10;
break;
case 3:
cout << "medium";
sizeCost = 12;
break;
case 4:
cout << "large";
sizeCost = 14;
break;
case 5:
cout << "extra large";
sizeCost= 14;
break;
case 6 :
cout << "NY style";
sizeCost = 16;
break;
default:
cout << " invaild number";
}
return;
}
// Function displays how many people the pizza can feed.
void feedPeeps(int numPersons) {
switch(numPersons){
case 1:
cout << "6";
break;
case 2:
cout << "6";
break;
case 3:
cout << "8";
break;
case 4:
cout << "10";
break;
case 5:
cout << "10";
break;
case 6 :
cout << "12";
break;
default:
cout << "invaild number";
}
return;
}
// Fuction displays crust type, updates inventory and calculates cost for the premium crust .
void crustType(int numCrust, int& crustCost, int& thinCrust, int& flatBread, int&thickCrust) {
switch(numCrust){
case 1:
cout << "thin crust";
thinCrust--;
crustCost = 0;
break;
case 2:
cout << "flatbread";
flatBread -= 1;
crustCost = 0;
break;
case 3:
cout << "thick crust";
thickCrust--;
crustCost = 2;
break;
default:
cout << " invaild number";
}
return;
}
// Function Tells topping choices, updates inventory and calculates cost for premium topping items.
void toppingChoices(int numToppings, int& cheese, int& pepperoni, int& mushroom, int& onions, int& sausage, int& hamburger, int& baconBits, int& blackOlives, int& greenPeppers, int& pineapple, int& mushroomCost, int& onionsCost, int& baconBitsCost, int& pineappleCost){
switch(numToppings){
case 1:
cout << "cheese";
cheese--;
break;
case 2:
cout << "pepperoni";
pepperoni--;
break;
case 3:
cout << "mushroom";
mushroom--;
mushroomCost++;
break;
case 4:
cout << "onions";
onions--;
onionsCost++;
break;
case 5:
cout << "sausage";
sausage--;
break;
case 6:
cout << "hamburger";
hamburger--;
break;
case 7:
cout << "BaconBits";
baconBits--;
baconBitsCost++;
break;
case 8:
cout << "blackOlives";
blackOlives--;
break;
case 9:
cout << "greenPeppers";
greenPeppers--;
break;
case 10:
cout << "pineapple";
pineapple--;
break;
}
}
//This function checks to make sure a party gets the apporiate size pizza
void partySizeCheck(int& orderNumSize, int& guestSize) {
switch (orderNumSize) {
case 1:
case 2:
if (guestSize > 6) {
cout << "Not enough Pizza, please choose a larger size.\n";
}
break;
case 3:
if (guestSize > 8) {
cout << "Not enough Pizza, please choose a larger size.\n";
}
break;
case 4:
case 5:
if (guestSize > 10) {
cout << "Not enough Pizza, please choose a larger size.\n";
}
break;
case 6:
if (guestSize > 12) {
cout << "Your party is too large how about ordering a second pizza?\n";
}
}
}
int main() {
int orderNumCrust;
int orderNumToppings;
int remainPizza = 0;
char moreToppings;
char displayOrder;
double splitCost;
char splitBill;
char morePizza;
double pizzaArray[4];
pizzaArray[0] = 0;
pizzaArray[1] = 0;
pizzaArray[2] = 0;
pizzaArray[3] = 0;
do {
// Asking about Size & ouputs how many it will feed
cout << "Welcome to Pizza Parlor, please enter a number from 1 to 6 to indicate the size pizza you want\n";
while((orderNumSize > 6) ||(orderNumSize < 1)){
cin >> orderNumSize;
if((orderNumSize > 6)|| (orderNumSize < 1)){
cout << "Enter a number between 1 and 6" << endl;
}
}
cout << "You have chosen to order a ";
PizzaSize(orderNumSize, sizeCost);
cout << ". ";
cout << "This will feed ";
feedPeeps(orderNumSize);
cout << " people." << endl;
// Asking about Crust Type
cout << "Please enter a number from 1 to 3 to indicate the type of crust you want.\n";
while(( orderNumCrust > 3) ||( orderNumCrust < 1)){
cin >> orderNumCrust;
if(( orderNumCrust> 3)||( orderNumCrust < 1)){
cout << "Enter a number between 1 and 3" << endl;
}
}
cout << "You have chosen ";
crustType(orderNumCrust, crustCost, thinCrust, flatBread, thickCrust);
cout << " as your crust.\n";
// Asking about toppings
cout << "Would your like toppings? (Y=yes, N=no)\n";
cin >> moreToppings;
while (moreToppings == 'Y') {
cout << "Please enter a number from 1 to 10 to indicate what toppings you would like on your pizza\n";
cin >> orderNumToppings;
if ((orderNumToppings <= 10) && (orderNumToppings >= 1)) {
cout << "You have added ";
toppingChoices(orderNumToppings, cheese, pepperoni, mushroom, onions, sausage,hamburger, baconBits, blackOlives, greenPeppers, pineapple, mushroomCost, onionsCost, baconBitsCost, pineappleCost);
cout << " to your order. Would you like to add more toppings? (Y = Yes, N = N)\n";
cin >> moreToppings;
}
else {
cout << "Invalid topping number. Please enter a number 1 through 10.\n";
}
}
// Adjust party size to correct pizza size
cout << "Please enter the number of guests you have in your party.\n";
cin >> guestSize;
partySizeCheck(orderNumSize, guestSize);
cout << "Great! your party size is " << guestSize << " people." << endl;
// Calcualtes bill
totalOrderCost = crustCost + sizeCost + mushroomCost + onionsCost + baconBitsCost + pineappleCost;
cout << "Great your total for today’s order at the Pizza Parlor was $" << totalOrderCost << endl;
cout << "Would you like an itemized list of your order? (Y = Yes N = No)" << endl;
cin >> displayOrder;
if (displayOrder == 'Y') {
cout << "Great your itemized total for your order was as follows:\n";
PizzaSize(orderNumSize, sizeCost);
cout << ": " << sizeCost << endl;
crustType(orderNumCrust, crustCost, thinCrust, flatBread, thickCrust);
cout << ": " << crustCost << endl;
cout << "Mushrooms: " << mushroomCost << endl;
cout << "Onions: " << onionsCost << endl;
cout << "Bacon Bits " << baconBitsCost << endl;
cout << "Pineapple: " << pineappleCost << endl;
cout << "Total: " << totalOrderCost << endl;
}
/// Splits Bill
cout << "Would you like to split the bill?(Y=yes, N=no)\n";
cin >> splitBill;
if (splitBill == 'Y') {
splitCost = totalOrderCost / guestSize;
cout << "The total cost for each of your " << guestSize << " guests will be $" << splitCost << endl;
}
remainPizza = 3 - numberOfPizzas;
// Determines if the coustmer wants to order another pizza & exits body
cout << "Would you like to order another pizza? You have " << remainPizza << " pizzas remaining (Y = Yes N = No)." << endl;
cin >> morePizza;
pizzaArray[numberOfPizzas] = totalOrderCost;
numberOfPizzas++;
}while((morePizza == 'Y') && (numberOfPizzas < 4));
cout << "Thank you for eating at the Pizza Parlor! Please come again soon!\n";
// Bussiness inventory and revenue satus.
for (int i = 0; i < 4; i++) {
totalRevenue += pizzaArray[i];
}
cout << "My total revenue for the night was: " << totalRevenue << endl;
cout << "My new QOH totals are as follows:" << endl;
cout << "Cheese: " << cheese << endl;
cout << "Pepperoni: " << pepperoni << endl;
cout << "Mushroom: " << mushroom << endl;
cout << "Onions: " << onions << endl;
cout << "Sauausge: " << sausage << endl;
cout << "Hamburger: " << hamburger << endl;
cout << "Bacon Bits: " << baconBits << endl;
cout << "BlackOlives: " << blackOlives << endl;
cout << "Green Peppers: " << greenPeppers << endl;
cout << "Pineapple: " << pineapple << endl;
cout << "Thin Crust " << thinCrust << endl;
cout << "Flat Bread " << flatBread << endl;
cout << "Thick Crust " << thickCrust << endl;
return 0;
}