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

Ingredient Adjuster

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.

Solution

 

regularBatchofcookies =48

 cups0f5ugarPer48Cookies = 1.5

 cups0f8utterPer48Cookies = 1

 cupsOfFlourPer48Cookies = 2.75

userNumberOfCookies =float( input( “Now many cookies do you want to make: ” )

expectedCups0f5ugar = ( userNumberOffookies / regularBatch0fCookies )

expectedCups0f8utter =( userNumberOffookies / regulareatchOffookies )

expectedCupsOfFlour =( userNumberWookies / regulartlatchOltookies )

 print( “For ” + str(userNumberOffookies ) +” you will need ” + \

 str( expectedCups0f5ugar ) + ” cupls of sugar, ” +\

str4 expectedCupsOfeutter ) + ” cups of butter and ” + \

str( expectedCupsOfFlour) + ” cups of flour” )