Answered step by step
Verified Expert Solution
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
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 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 ConsoleStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started