Need Help ?

Home / Expert Answers / Other / 3-4-points-far-less-disgusting-than-the-chicken-nuggets-on-the-practice-quiz-suppose-you-want-to-buy

(Answered): 3. (4 points) Far less disgusting than the Chicken Nuggets on the practice quiz. Suppose you want t ...




3. (4 points) Far less disgusting than the Chicken Nuggets on the practice quiz. Suppose you want to buy n > 18 cans of sóda.
3. (4 points) Far less disgusting than the Chicken Nuggets on the practice quiz. Suppose you want to buy n > 18 cans of sóda. The store only sells these in packs of five (5) cans or six (6) cans, and you must buy full packs of each (you cannot break up a six-pack and get two cans from it). Your goal is to get exactly n cans of soda, assuming there are as many packs available as you need. Use the variable numSmall to represent the number of 5-packs and the variable numLarge for the number of 6-packs. Finish the recursive function below to complete the ordering and return the counts by reference parameters. You may assume for this problem that there will be no overflow or underflow at any point in the problem and that stack space is not a concern. The code has been started for you and is part of a correct solution. void buySoda (unsigned n, unsigned & numSmall, unsigned & numLarge) { if( 20 = n) { numSmall 4;. numLarge 0; } else if (21 = n) { numSmall 3; num Large = 1; 3


We have an Answer from Expert

View Expert Answer

Expert Answer


Answer to 3. (4 points) Far less disgusting than the Chicken Nuggets on the practice quiz. Suppose you want to buy n > 18 cans of ...
We have an Answer from Expert

Buy This Answer $4

Place Order