Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help me correct my code on java. my professor didn't like the way I did my program because I used static double instead of

image text in transcribedimage text in transcribedimage text in transcribedplease help me correct my code on java. my professor didn't like the way I did my program because I used static double instead of using final constants. Im so stuck on this and I'm doing this on eclipse IDLE

15. 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 these amounts of the ingredients. Write a program that asks the user how many cookies he or she wants to make, then displays the number of cups of each ingredient needed for the specified number of cookies. Expl... *Ingredientadjuster.java 1 package ingredientadjuster; ontrerasassignment1 3 import java.util.Scanner; orkassigment 4 class Ingredientadjuster { entadjsuter2 5 static double CUPS_OF_SUGAR = 1.5d; entAdjuster 6 static double CUPS_OF_BUTTER = 1.0d; 7 System Library [Java static double CUPS_OF_FLOUR = 2.75d; 8 static int REGULAR_BATCH_OF_COOKIES = 48; 9 static int input; hicken 100 public static void main(String[] args) { Ingredients.java 11 Scanner sc = new Scanner(System.in); module-info.java 12 System.out.println("Enter How many cookies you want to make : "); 13 input = sc.nextInt(); entadjuster 1 14 entadjuster2 15 entAdjuster3 16 if(input >=1) { //condition for input more than 11 System Library [Java: 17 CUPS_OF_FLOUR += CUPS_OF_FLOUR * (input-1); 18 CUPS_OF_BUTTER += CUPS_OF_BUTTER * (input-i); 19 CUPS_OF_SUGAR += CUPS_OF_SUGAR * (input-1); ngredientadjuster 20 Ingredientadjuster.j. 21 22 System.out.println("For " + input + "cookies you require the following CUPS of ingredient "); 23 System.out.println("Sugar: " + CUPS_OF_SUGAR + " Butter: " + CUPS_OF_BUTTER + " Flour: " + CUPS_OF_FLOUR); 24 } blem 25 else { olem 1 System.out.println(" You entered" + input + "amount of cookies. so, In CUPS of ingredients for " + REGULAR_BATCH_OF_COOKIES + "cookies CUPS_OF_FLOUR += CUPS_OF_FLOUR * 47; CUPS_OF_BUTTER += CUPS_OF_BUTTER * 47; CUPS_OF_SUGAR += CUPS_OF_SUGAR * 47; System.out.println("Sugar: " + CUPS_OF_SUGAR + " Butter: " + CUPS_OF_BUTTER + "Flour: " + CUPS_OF_FLOUR); } sc.close(); 33 } 34 35} problem @ Javadoc Declaration Console Ingredientadjuster (1) Java Application] /Users/diegocontreras/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.macosx.x86_64_15.0.1.20201027-0507/jre/bin/java (Feb 1, 2021, 3:51 Enter How many cookies you want to make : 12 For 12 cookies you require the following CUPS of ingredient Sugar: 18.0 Butter: 12.0 Flour: 33.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago