186k views
1 vote
java Consider the following problem statement. 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. Format your output nicely that all numbers and decimals align as shown in the example! Limit decimals to four digits.

1 Answer

0 votes

Answer:

Step-by-step explanation:

The following code is written in Java. It creates a program that asks the user how many cookies they want to make. Then it adjusts the original recipe based on the ratio of the original amount of cookies it makes to the amount the user wants. Finally, passing the output of the new adjusted recipe to the user. Due to technical difficulties, I have added the code as a txt file attached below.

java Consider the following problem statement. A cookie recipe calls for the following-example-1
User Paul Cager
by
4.4k points