1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
#include <iostream>
#include <string>
using namespace std;
int main()
{
int numberOfAnticipatedGuests, numberOfPanGriddles, numberOfBaconGriddles,
numberOfCheeseGriddles, potatoChipBoxes, numberOfPickleJars, gatheringType, realPancake, realBacon;
double lengthOfEventInHours, avgNumOfGuestsPerHr;
char picklesNeeded, chipsNeeded, baconNeeded;
const char YES_TO_PICKLES = 'Y', NO_TO_PICKLES = 'N', YES_TO_BACON = 'Y', NO_TO_BACON = 'N', YES_TO_CHIPS = 'N', NO_TO_CHIPS = 'N';
const int pancakesPerHour = 240, baconPerHour = 550, grilledCheesePerHour = 200, picklesPerJar = 22, servingsPerBox = 25;
const string ERROR = "ERROR";
cout << "What kind of event do you want to plan?";
cout << "\n1. Pancake Breakfast";
cout << "\n2. Grilled Cheese Luncheon";
cout << "\n Please please 1 or 2 ";
cin >> gatheringType;
if (gatheringType == 1)
{
cout << "\nplease input your anticipated number of guests: ";
cin >> numberOfAnticipatedGuests;
cout << "\nPlease Input your event in Hours";
cin >> lengthOfEventInHours;
cout << "\nwould you like bacon?";
cin >> baconNeeded;
baconNeeded = toupper(baconNeeded);
if (baconNeeded == YES_TO_BACON)
{
realPancake = numberOfAnticipatedGuests * 3;
realBacon = numberOfAnticipatedGuests * 3;
numberOfPanGriddles = realPancake / pancakesPerHour;
numberOfBaconGriddles = realBacon / baconPerHour;
avgNumOfGuestsPerHr = numberOfAnticipatedGuests / lengthOfEventInHours;
cout << "Bacon Chosen";
}
else if (baconNeeded == NO_TO_BACON)
{
realPancake = numberOfAnticipatedGuests * 3;
realBacon = numberOfAnticipatedGuests * 3;
numberOfPanGriddles = realPancake / pancakesPerHour;
numberOfBaconGriddles = 0;
avgNumOfGuestsPerHr = numberOfAnticipatedGuests / lengthOfEventInHours;
}
cout << "\nyour number of anticipated guests is: ";
cout << numberOfAnticipatedGuests;
cout << "\nthe length of your event is: ";
cout << lengthOfEventInHours;
cout << "\nthe average number of guests per hour is";
cout << avgNumOfGuestsPerHr;
cout << "\nthe number of pancake griddles";
cout << numberOfPanGriddles;
cout << "\nthe number of bacon griddles\n";
cout << numberOfBaconGriddles;
}
else if (gatheringType == 2)
{
cout << "\nplease input your anticipated number of guests: ";
cin >> numberOfAnticipatedGuests;
cout << "\nPlease Input your event in Hours";
cin >> lengthOfEventInHours;
cout << "\nwould you like pickles?";
cin >> picklesNeeded;
picklesNeeded = toupper(picklesNeeded);
cout << "\nwould you like chips? ";
cin >> chipsNeeded;
chipsNeeded = toupper(chipsNeeded);
if (picklesNeeded == YES_TO_PICKLES && chipsNeeded == NO_TO_CHIPS)
{
numberOfCheeseGriddles = numberOfAnticipatedGuests / grilledCheesePerHour;
numberOfPickleJars = numberOfAnticipatedGuests / picklesPerJar;
potatoChipBoxes = 0;
}
else if (picklesNeeded == NO_TO_PICKLES && chipsNeeded == YES_TO_CHIPS)
{
numberOfCheeseGriddles = numberOfAnticipatedGuests / grilledCheesePerHour;
numberOfPickleJars = 0;
potatoChipBoxes = numberOfAnticipatedGuests / servingsPerBox;
}
else if (picklesNeeded == YES_TO_PICKLES && chipsNeeded == YES_TO_CHIPS)
{
numberOfCheeseGriddles = numberOfAnticipatedGuests / grilledCheesePerHour;
numberOfPickleJars = numberOfAnticipatedGuests / picklesPerJar;
potatoChipBoxes = numberOfAnticipatedGuests / servingsPerBox;
}
else if (picklesNeeded == NO_TO_PICKLES && chipsNeeded == NO_TO_CHIPS)
{
numberOfCheeseGriddles = numberOfAnticipatedGuests / grilledCheesePerHour;
numberOfPickleJars = 0;
potatoChipBoxes = 0;
}
avgNumOfGuestsPerHr = numberOfAnticipatedGuests / lengthOfEventInHours;
cout << "your number of anticipated guests is: ";
cout << numberOfAnticipatedGuests;
cout << "the length of your event is: ";
cout << lengthOfEventInHours;
cout << "the average number of guests per hour is";
cout << avgNumOfGuestsPerHr;
cout << "the number of griddles needed for grilled cheese is";
cout << numberOfCheeseGriddles;
cout << "the number of pickle jars needed is";
cout << numberOfPickleJars;
cout << "the number of chip boxes needed is";
cout << potatoChipBoxes;
}
else
{
cout << ERROR << endl;
return 0;
}
return 0;
}
|