Rhorrace Prog1

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 8

//Horrace,Robert, CS 162

//This is program is designed to


//help the user order a burger of his
//customization
#include <iostream>
#include <cctype>
using namespace std;
int main()
{
//variables
char loop;
char again;
char bunchoice;
char bread;
char bun;
char tortilla;
char patty;
char cheese;
char toppings;
char lettuce;
char tomatoes;
char pickles;
char ketchup;
char mustard;
char mayo;
char combo;
char drink;
char soda;
char water;
char milkshake;
char cook1;
char cook2;
float pattycost;
float cheesecost;
float sodacost;
float watercost;
float shakecost;
float total;
//Welcom
cout << "FOR EMPLOYEES ONLY, press E to end the program(at Would you kin
dly hit Y to enter)" << endl;
loop = 'N';
while(loop == 'N')
{
cout << "Welcome to Rapture's Burgers!" << endl;
cout << "Where we make burgers to your desire" << endl;
cout << "from our selectable choices." << endl;
cout << "We only have burgers,fries," << endl;
cout << "sodas, and shakes." << endl;
cout << "Also, combos come with fries and a drink," << endl;
cout << "and you can only get fries and a drink by ordering a c
ombo." << endl;
cout << "If you are someone who can't eat gluten," << endl;
cout << "Would you kindly select the gluten free selections." <<
endl;
cout << "Would you kindly enjoy the meals" << endl;

cout << " Would you kindly hit Y to enter:" << endl;
cin >> loop;
loop = toupper(loop);
again = 'Y';
total = 0;
while(!isalpha(loop) || loop != 'Y' && loop != 'E')
{
cout << "Error: does not compute" << endl;
cout << "Would you kindly hit Y to enter:";
cin >> loop;
loop = toupper(loop);
}
while(loop == 'Y' && again == 'Y')
{
//bread selection
cout << "A=bread" << endl;
cout << "B=bun" << endl;
cout << "C=tortilla" <<endl;
cout << "Would you kindly choose the type of bun you wou
ld like(A/B/C):";
cin >> bunchoice;
bunchoice = toupper(bunchoice);
while(!isalpha(bunchoice) || bunchoice > 'C')
{
cout << "Error: choice must be either A, B, or C
" << endl;
cout << "Would you kindly choose the type of bu
n you would like(A/B/C):";
cin >> bunchoice;
bunchoice = toupper(bunchoice);
}
//bread type
if(bunchoice == 'A')
{
cout << "A=white" << endl;
cout << "B=wheat" << endl;
cout << "C=gluten free" << endl;
cout << "Would you kindly choose the type of bre
ad you would like(A/B/C):";
cin >> bread;
bread = toupper(bread);
while(!isalpha(bread) || bread > 'C')
{
cout << "Error: choice must be either A,
B, or C" << endl;
cout << "Would you kindly choose the typ
e of bread you would like(A/B/C):";
cin >> bread;
bread = toupper(bread);
}
}
//bun type
if(bunchoice == 'B')
{
cout << "A=plain" << endl;
cout << "B=sesame seed" << endl;
cout << "C=gluten free" << endl;
cout << "Would you kindly choose the type of ham
burger bun you would like(A/B/C):";
cin >> bun;

bun=toupper(bun);
while(!isalpha(bun) || bun > 'C')
{
cout << "Error: choice must be either A,
B, or C" << endl;
cout << "Would you kindly choose the typ
e of hamburger bun you wuld like(A/B/C):";
cin >> bun;
bun = toupper(bun);
}
}
//tortilla type
if(bunchoice == 'C')
{
cout << "A=flour" << endl;
cout << "B=corn" << endl;
cout << "C=gluten free" << endl;
cout << "Would you kindly choose the type of tor
tilla you would like(A/B/C):";
cin >> tortilla;
tortilla=toupper(tortilla);
while(!isalpha(tortilla) || tortilla > 'C')
{
cout << "Error: choice must be either A,
B, or C" << endl;
cout << "Would you kindly choose the typ
e of tortilla you would like(A/B/C):";
cin >> tortilla;
tortilla = toupper(tortilla);
}
}
//patty type
cout << "A=beef" << endl;
cout << "B=chicken" << endl;
cout << "C=veggie burger(black bean)" << endl;
cout << "Would you kindly choose the type of patty you w
ould like(A/B/C):";
cin >> patty;
patty = toupper(patty);
if(!isalpha(patty) || patty > 'C')
{
cout << "Error: choice must be either A, B, or C
" << endl;
cout << "Would you kindly choose the type of pat
ty you would like(A/B/C):";
cin >> patty;
patty = toupper(patty);
}
//beef
if(patty == 'A')
{
cout << "A=pink" << endl;
cout << "B=no pink" << endl;
cout << "pink or no pink?(A/B):";
cin >> cook1;
cook1 = toupper(cook1);
pattycost= 4.00;
while(!isalpha(cook1) || patty > 'B')
{
cout << "Error: choice must be either A

or B" << endl;


cout << "pink or no pink?(A/B):";
cin >> cook1;
cook1 = toupper(cook1);
}
}
//chicken
if(patty == 'B')
{
cout << "A=grilled" << endl;
cout << "B=crispy" << endl;
cout << "grilled or crispy?(A/B):";
cin >> cook2;
cook2 = toupper(cook2);
pattycost = 4.00;
while(!isalpha(cook2) || patty > 'B')
{
cout << "Error: choice must be either A
or B" << endl;
cout << "grilled or crispy?(A/B):";
cin >> cook2;
cook2 = toupper(cook2);
}
}
//veggie burger
if(patty == 'C')
{
pattycost = 5.00;
}
//cheese type
cout << "A=cheddar" << endl;
cout << "B=american" << endl;
cout << "C=swiss" << endl;
cout << "D=none" << endl;
cout << "Would you kindly choose the type of cheese you
would like(A/B/C/D):";
cin >> cheese;
cheese = toupper(cheese);
while(!isalpha(cheese) || cheese > 'D')
{
cout << "Error: choice must be A, B, C, or D" <<
endl;
cout << "Would you kindly choose the type of che
ese you would like(A/B/C/D):";
cin >> cheese;
cheese = toupper(cheese);
}
if(cheese <= 'C')
{
cheesecost = 0.75;
}
//toppings
cout << "Would like any toppings(Y/N):";
cin >> toppings;
toppings = toupper(toppings);
while(!isalpha(toppings) || toppings != 'Y' && toppings
!= 'N')
{
cout << "Error: choice must be Y or N" << endl;
cout << "Would you like any toppings(Y/N):";

cin >> toppings;


toppings = toupper(toppings);
}
if(toppings == 'Y')
{
cout << "lettuce(Y/N):";
cin >> lettuce;
lettuce = toupper(lettuce);
while(!isalpha(lettuce) || lettuce != 'Y' && let
tuce != 'N')
{
cout << "Error: choice must be Y or N" <
< endl;
cout << "lettuce(Y/N):";
cin >> lettuce;
lettuce = toupper(lettuce);
}
cout << "tomatoes(Y/N):";
cin >> tomatoes;
tomatoes = toupper(tomatoes);
while(!isalpha(tomatoes) || tomatoes != 'Y' && t
omatoes != 'N')
{
cout << "Error: choice must be Y or N" <
< endl;
cout << "tomatoes(Y/N):";
cin >> tomatoes;
tomatoes = toupper(tomatoes);
}
cout << "pickles(Y/N):";
cin >> pickles;
pickles = toupper(pickles);
while(!isalpha(pickles) || pickles != 'Y' && pic
kles != 'N')
{
cout << "Error: choice must be Y or N" <
< endl;
cout << "Would you like any pickles(Y/N)
:";
cin >> pickles;
pickles = toupper(pickles);
}
cout << "ketchup(Y/N):";
cin >> ketchup;
ketchup = toupper(ketchup);
while(!isalpha(ketchup) || ketchup != 'Y' && ket
chup != 'N')
{
cout << "Error: choice must be Y or N" <
< endl;
cout << "ketchup(Y/N):";
cin >> ketchup;
ketchup = toupper(ketchup);
}
while(!isalpha(ketchup) || ketchup != 'Y' && ket
chup != 'N')
{
cout << "Error: choice must be Y or N" <
< endl;
cout << "ketchup(Y/N):";

cin >> ketchup;


ketchup = toupper(ketchup);
}
cout << "mustard(Y/N):";
cin >> mustard;
mustard = toupper(mustard);
while(!isalpha(mustard) || mustard != 'Y' && mus
tard != 'N')
{
cout << "Error: choice must be Y or N" <
< endl;
cout << "mustard(Y/N):";
cin >> mustard;
mustard = toupper(mustard);
}
cout << "mayo(Y/N):";
cin >> mayo;
mayo = toupper(mayo);
while(!isalpha(mayo) || mayo != 'Y' && mayo != '
N')
{
cout << "Error: choice must Y or N" << e
ndl;
cout << "mayo(Y/N):";
cin >> mayo;
mayo = toupper(mayo);
}
}
//combo?
cout << "Would you like to combo you meal?(Y/N):";
cin >> combo;
combo = toupper(combo);
while(!isalpha(combo) || combo != 'Y' && combo != 'N')
{
cout << "Error: choice must be Y or N" << endl;
cout << "Would you like to combo your meal?(Y/N)
:";
cin >> combo;
combo = toupper(combo);
}
//choose a drink
if(combo == 'Y')
{
cout << "A=soda" << endl;
cout << "B=water" << endl;
cout << "C=milkshake" << endl;
cout << "Would you kindly choose a drink(A/B/C):
";
cin >> drink;
drink = toupper(drink);
while(!isalpha(drink) || drink > 'C')
{
cout << "Error: choice must be A, B, or
C" << endl;
cout << "Would you kindly choose a drink
(A/B/C):";
cin >> drink;
drink = toupper(drink);
}
//soda

if(drink == 'A')
{
cout << "A=diet";
cout << "B=regular";
cout << "diet or regular(A/B):";
cin >> soda;
soda = toupper(soda);
sodacost = 2.50;
while(!isalpha(soda) || soda > 'B')
{
cout << "Error: choice must be A
or B" << endl;
cout << "diet or regular(A/B):";
cin >> soda;
soda = toupper(soda);
}
}
//water
if(drink == 'B')
{
watercost = 1.00;
}
//milkshake
if(drink == 'C')
{
cout << "A=vanilla" << endl;
cout << "B=chocolate" << endl;
cout << "vanilla or chocolate(A/B):";
cin >> milkshake;
milkshake = toupper(milkshake);
shakecost= 3.50;
while(!isalpha(milkshake) || milkshake >
'B')
{
cout << "Error: choice must be A
or B" << endl;
cout << "vanilla or chocolate(A/
B):";
cin >> milkshake;
milkshake = toupper(milkshake);
}
}
}
//compute price/display
if(patty <= 'C' && cheese <= 'C' && combo == 'N')
{
total += pattycost + cheesecost;
cout << "Your total is $" << total << endl;
}
if(patty <= 'C' && cheese == 'D' && combo == 'N')
{
total += pattycost;
cout << "Your total is $" << total << endl;
}
if(patty <='C' && cheese <= 'C' && combo == 'Y')
{
total += pattycost + cheesecost;
if(drink == 'A')
{
total += sodacost;

cout << "Your total is $" << total << en


dl;
}
if(drink == 'B')
{
total += watercost;
cout << "Yor total is $" << total << end
l;
}
if(drink == 'C')
{
total += shakecost;
cout << "Your total is $" << total << en
dl;
}
}
if(patty <= 'C' && cheese == 'D' && combo == 'Y')
{
total += pattycost;
if(drink == 'A')
{
total += sodacost;
cout << "Your total is $" << total << en
dl;
}
if(drink == 'B')
{
total += watercost;
cout << "Your total is $" << total << en
dl;
}
if(drink == 'C')
{
total += shakecost;
cout << "Your total is $" << total << en
dl;
}
}
cout << "Would you like to order another burger?(Y/N):";
cin >> again;
again = toupper(again);
loop = 'N';
while(!isalpha(again) || again != 'Y' && again != 'N')
{
cout << "Error: response must be Y or N";
cout << "Would you like to order another burger(Y/N):";
cin >> again;
again = toupper(again);
}
}
}
return 0;
}

You might also like