0
$\begingroup$

Here is the question:

A cookie recipe calls for the following ingredients:

  • 1.5 cups of sugar
  • 1 cup of butter
  • 2.75 cups of flour

The recipe produces 48 cookies with this amount of the ingredients. Write a program that asks the user how many cookies he or she wants to make, and then displays the number of cups of each ingredient needed for the specified number of cookies.

I already saw the answer, and it only confused me more. I need someone to explain to me how we go about figuring out how many cups of sugar is needed if, for example, the user wants to bake 50 cookies.

EDIT: I'm mainly interested in the thought process used to solve the math portion of this problem.

$\endgroup$
  • 3
    $\begingroup$ How much of each ingredient do you need for one cookie? $\endgroup$ – Ben Longo Jan 9 '16 at 8:40
  • $\begingroup$ @BenLongo 0.0375 cups of sugar ... Then multiply this by the number of cookies the user needs ..... wow, I feel stupid. I looked at this problem with all 3 ingredients combined together, confusing the heck out of me. Thanks :) $\endgroup$ – code_flow Jan 9 '16 at 8:45
2
$\begingroup$

First of all, scale down the various ingredient requirements from a 48-cookie batch size to an individual cookie size. This is done by dividing your three amounts {1.5, 1, 2.75} by 48, giving {1/32, 1/48, 11/192}. Then all one has to do is multiply the required cookie batch size by each of these individual amounts. At least that is how I'd do it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.