In: Computer Science
A cookie recepie calls for the following ingridients
1.5 cups of sugar
1 cup of butter
2.75 cups of flour
The recepie produce48 cookies with these amountof the ingridients.
Design a program
that asks the user how many cookie he wants to make, and then
displays the numberof cups of eacj iongredient
needed for the specefied number of cookies
// Declare the variables
Declare Real numberOfCookies = 48
Declare Real cupsOfSugar = 1.5
Declare Real cupsOfButter = 1
Declare Real cupsOfFlour = 2.75
Display " Enter the number of cookies "
Input cookies
//Get the amount of sugar you need
set sugar = cookies * cupsOfSugar / numberOfCookies
// Get the amou of butter you need
set butter = cookies * cupsOfButter / numberOfCookies
// Get the amount of flour you need
set flour = cookies * cupsOfFlour / numberOfCookies
Display " To produce -------
please check this pseudocode is ok or not and what i need to write in last line " Display " area
// Declare the variables Declare Real numberOfCookies = 48 Declare Real cupsOfSugar = 1.5 Declare Real cupsOfButter = 1 Declare Real cupsOfFlour = 2.75 Display "Enter the number of cookies " Input cookies //Get the amount of sugar you need set sugar = cookies * cupsOfSugar / numberOfCookies // Get the amount of butter you need set butter = cookies * cupsOfButter / numberOfCookies // Get the amount of flour you need set flour = cookies * cupsOfFlour / numberOfCookies // display the output. Display "You need " + sugar + " cups Sugar" Display "You need " + butter + " cups Butter" Display "You need " + flour + " cups Flour"
************************************************** Your pseudocode is fine.. Thanks for your question. We try our best to help you with detailed answers, But in any case, if you need any modification or have a query/issue with respect to above answer, Please ask that in the comment section. We will surely try to address your query ASAP and resolve the issue.
Please consider providing a thumbs up to this question if it helps you. by Doing that, You will help other students, who are facing similar issue.