about | help | code help+videos | done | prefs |
Write a method that returns a score of 1, 2, or 3 for how full you could be on Thanksgiving based on how many people will be at your party and how much food will be available. There are three parameters to tell you information about your party. The parameter "people" will indicate how many people will attend. This will be a number greater than or equal to 1. The parameter "turkeyPounds" will tell how many pounds of turkey you will have (in an integer number of pounds). The parameter "stuffing" will be true if you are having stuffing and false otherwise. The pounds per person is simply the amount of turkey in pounds divided by the number of people present (using integer division). For example, 8 pounds of turkey for 5 people is 1 pound per person (since 8/5=1 using integer division). Note that 8 pounds for 7 people is also 1 pound per person, using integer division. Once you calculate the pounds per person, add one pound if stuffing is true. This is the "adjusted pounds per person". Return a 1 if the adjusted pounds per person is 2 or less. Return a 2 if the adjusted pounds per person is between 3 and 5 inclusive. Return a 3 if the adjusted pounds per person is 6 or more. Gobble gobble. turkeyDay(15, 15, false) → 1 turkeyDay(20, 90, true) → 2 turkeyDay(4, 22, false) → 2 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 250
Copyright Nick Parlante 2017 - privacy