Background: Krusty Burgers are reportedly at the top of the "Most Evil Foods Ever" list, a list of commonly eaten pseudo-foods kept by the Division of Eatable Alternatives To Health, Federal Oversight Organization on Digested Stuff (DEATHFOODS for short). But, no matter ... Krusty and his Krusty Burger restaraunt hold a burger eating contest every year in Springfield. In hw #10, you are going to write a program to simulate that contest. Your program will create an array of customers, have them eat burgers in turn, eating until they either die, quit, or win. Nice, eh? In preparation for this impending carnage, you are going to code up a few classes for this assignment #9. You will also write a main function whose sole purpose is to test the classes you have created. By this we mean that it will declare objects of the types you created and then test their member functions. There is no other purpose to your main function. This type of main is commonly called a driver.
Specifications: In this assignment, you will create two classes. The first is a burger class.
Your burger class is to contain the following:
Member variables:
Member functions:
Notes: Cheese on a burger costs an extra $.25; special sauce is $.10. A virulent pathogen is free of charge, though you WILL pay in the end.
Your customer class has the following:
Member variables:
Member functions:
chol gain = 2.5 * B + (PI/2) * P + wt/((K + 1)*10),
where B is the number of oz of bacon
P is the number of patties
K is the number of piKles
wt gain = 0.5*P2 + (1/8)*B2 - K/4 + C + S,
where B, P, and K are as above and
C is the gain attributed to cheese, currently determined to be 1.2
S is the gain attributed to special sauce, currently determined to be 2.1
*These last two values added only when cheese and sauce are present
Note: The above descriptions of these classes are bare minimum. You may find it necessary or desirable to add relevant member variables and/or private member functions (to help make the code better). You should NOT add other public functions.
We reserve the right to change these classes and the formulas for wt gain and chol gain for hw #10. We have yet to code this up to see what happens; it's hard to guess, but we want it to be fun and interesting.
Your driver (that's your main function) should declare objects of the types you have defined. It should test the member functions, including the constructors. After declaring these objects, output them to see their initial states. Pass a burger to a customer (to eat) and output the customer to see the effects. There should be no interaction with the user of the program. The driver is there merely to test your coding of the classes. Make the testing thorough.
Background: Assignment 09
Foreground: Here's the big picture. Your program is going to be a simulation of a burger eating contest at Krusty Burger! In brief, you will have an array of customers (the contestants) eating burgers in multiple rounds of the contest to see who "survives". Sometimes there is a single winner (survivor) and sometimes there are more. You will identify the winners and their stats.
Specifications: In this assignment, you will use your classes from hw #9 and add another class:
A burgermeister class is to contain the following:
Member variables:
Member functions:
You may have other members/functions, but that's up to you to decide.
The Customer class will be modified to include a health value that the constructor will randomly assign between 1 and 100, inclusive. A value of 0 is synonymous with death and should not be assigned by the constructor. You may have to add other member variables and/or functions to this class.
The contest will proceed as follows: There will be as many rounds as is necessary, ending when there are no contestants still eating burgers. You will start with an array of 15 customers; these are the contestants. In each round, every contestant is fed a burger if (s)he can eat it. Being able to eat a burger is determined by whether or not the contestant is alive, can pay for the burger, and is still a contestant. After the start of the contest, a contestant can become a non-contestant by either dying or angering the burgermeister so that (s)he disqualifies him/her (this is described later). When a contestant eats a burger, (s)he pays the burgermeister -- ok, I'm going to call him Krusty and you really should too -- the cost of the burger. Now things get interesting. As in hw 9, the customer's weight and cholesterol are adjusted accordingly. In addition, their health value is decremented by 2 points. Also, if a burger with a virulent pathogen is consumed, then the customer will either die or sicken and vomit. To determine which, "roll a 101-sided die"; if the value that comes up is greater than the customer's health value, they die; if the value is equal to or less than his/her health value, they vomit and their health is halved. If a contestant (let's call him Alpha) vomits, then there is a 50% chance that his neighbors will also vomit. So, if Alpha vomits, your code will have to first walk down the array of contestants determining (with a 50% chance) if the next contestant vomits....and if so, then the next....and if so, then the next....until you reach the bottom end of the array or someone doesn't vomit or the next guy/gal is dead. (Note: even alive non-contestants can puke.) After walking down the array, you will need to walk up the array doing the same until reaching the top of the array or someone doesn't vomit or you reach a dead contestant (thank God dead guys don't puke!). Now, in both cases (going down and going up), if the chain-reaction vomiting ends by someone just not vomiting, then that contestant has a 70% chance of starting a food fight. This means that (s)he throws a burger at another contestant or Krusty. Their target is chosen at random and can include themselves (stupid, yes, how stupid can you get - eating KrustyBurgers). When another contestant is hit by a burger, they have a 80% chance of continuing the fight by randomly choosing a target and throwing a burger. Each thrown burger has to be paid for by the thrower, but the thrower's health increments by 2 points. The food fight stops when someone decides not to throw, can't afford the burger to throw, a dead contestant is the target, or if Krusty is hit. If Krusty is hit, he gets angry and disqualifies the guy who hit him with a burger, and robs the thrower of all his cash. After the food fight ends 1) in the lower end of the array, continue checking for pukers in the upper end of the array; 2) in the upper end of the array, continue to the next round of feeding! The contest ends when no one can eat another burger - they are dead, out of the contest, or can't afford the burger.
Details:
Begin the Contest!!!
The Contestants are
Marge Simpson 134 lbs ...
Barney Gumble 56 lbs ...Image result for flying hamburgers
etc
------------------------ ROUND #1 -------------------
Marge Simpson eats Krusty Veggie Burger wt 144, chol 188, ... ALIVE
Barney Gumble eats Krusty Double Blah Blah Burger wt 77, chol 305 ... DEAD
Chief Wiggum eats Krusty Single Yadi Yadi Burger wt 300, chol 221 ... ALIVE and barfs!
Bart barfs GAGGGG! BLAHHHCCCH
Lisa barfs BARBARA STREISAND!!
Lenny doesn't barf
Lenny tosses burger at Chief Wiggum
Chief Wiggum tosses burger at Homer Simpson
Homer Simpson tosses burger at Homer Simpson
Principle Skinner barfs
Edna Krabappel doesn't barf
Priciple Skinner eats Krusty ...... Burger wt 212, chol 34, .... ALIVE
ETC
-------------------------ROUND #2 ---------------------
Marge Simpson eats .........
ETC