Question: Please do not change code that I have already written, and please do not write code in places other than where I indicate, unless you

Please do not change code that I have already written, and please do not write code in places other than where I indicate, unless you discuss it with me first. If you feel unable to complete an assignment in the way I have instructed, then that is probably a good sign that there is a concept or topic where you need to improve your understanding.

If you are still having trouble getting set up with the JDK and an IDE, you can test your code out here or here, for the time-being. However, if you do this, you are still responsible for turning in your code in a manner that is complete, correct, and easy to read.

Copy/paste the following code into a file and save as Recipe.java. Note that it will not compile in its present state because there are symbols that you still need to replace with correct code. For the homework, choose a basic recipe with 3-5 ingredients and very simple instructions. Replace the "?????" with appropriate code to get the desired information from the user and store it in the right variable.

import java.util.Scanner; public class Recipe { public static void main (String[] args){ Scanner scan = new Scanner (System.in); // Information about recipe String title, instructions; // Variables to be used (and reused) // for each ingredient double amount; String ingredient; String units; // Each variable will be a string containing // the name, amount, and units for one of the // ingredients in the recipe. You may need more // or less such variables, depending on how many // ingredients your recipe has. String ing1, ing2, ing3; int component = 0; // Get recipe title from user System.out.print("What is this recipe called? "); ????? // Note that the next 8 lines will repeat // a number of times, depending on how many // ingredients your recipe has. The main thing // that will change each time is the seventh // line: ing1, ing2, ing 3, etc. System.out.print("Ingredient #" + ++component + ": "); ????? System.out.print("How many? "); ????? System.out.print("What units? "); ????? ing1 = amount + " " + units + " of " + ingredient; System.out.println(); // Second ingredient System.out.print("Ingredient #" + ++component + ": "); ????? System.out.print("How many? "); ????? System.out.print("What units? "); ????? ing2 = amount + " " + units + " of " + ingredient; System.out.println(); // Third ingredient System.out.print("Ingredient #" + ++component + ": "); ????? System.out.print("How many? "); ????? System.out.print("What units? "); ????? ing3 = amount + " " + units + " of " + ingredient; System.out.println(); // Add more code here to get fourth and fifth // ingredients, if needed. // Ask user for instructions. When user types out // instructions and presses enter, you will get them in // a string and save it to the appropriate variable System.out.println("Please enter the instructions:"); ????? System.out.println(); System.out.println("###" + title + "###"); System.out.println("Ingredients (" + component + " total): "); System.out.println("* " + ing1); System.out.println("* " + ing2); System.out.println("* " + ing3); System.out.println("Instructions: " + instructions); } } 

Program output, when the program is run, should look something like this:

What is this recipe called? Coffee Ingredient #1: instant coffee How many? 1 What units? heaping teaspoon Ingredient #2: water How many? 0.8 What units? cups Ingredient #3: milk How many? 0.2 What units? cups Please enter the instructions: Heat the water, and stir in the instant coffee and milk. ###Coffee### Ingredients (3 total): * 1.0 heaping teaspoon of instant coffee * 0.8 cups of water * 0.2 cups of milk Instructions: Heat the water, and stir in the instant coffee and milk.

Please do not change code that I have already written, and please

do not write code in places other than where I indicate, unless

you discuss it with me first. If you feel unable to complete

Please do not change code that I have already written, and please do not write code in places other than where I indicate, unless you discuss it with me first. If you feel unable to complete an assignment in the way I have instructed, then that is probably a good sign that there is a concept or topic where you need to improve your understanding. If you are still having trouble getting set up with the JDK and an IDE, you can test your code out here or here, for the time-being. However, if you do this, you are still responsible for turning in your code in a manner that is complete, correct, and easy to read Copy/paste the following code into a file and save as Recipe.java. Note that it will not compile in its present state because there are symbols that you still need to replace with correct code. For the homework, choose a basic recipe with 3-5 ingredients and very simple instructions. Replace the "?????" with appropriate code to get the desired information from the user and store it in the right variable. import java.util.Scanner; public class Recipe { public static void main (String[] args) { Scanner scan = new Scanner (System.in); // Information about recipe String title, instructions; // Variables to be used (and reused) // for each ingredient double amount; String ingredient; String units; // Each variable will be a string containing // the name, amount, and units for one of the // ingredients in the recipe. You may need more // or less such variables, depending on how many // ingredients your recipe has. String ingi, ing2, ing3; int component = 0; // Get recipe title from user System.out.print("What is this recipe called? "); ????? // Note that the next 8 lines will repeat // a number of times, depending on how many // ingredients your recipe has. The main thing // that will change each time is the seventh // line: ingi, ing2, ing 3, etc. System.out.print("Ingredient #" + ++component + ": "); ????? System.out.print("How many? "); ????? System.out.print("What units? "); ????? ingl = amount + + units + of " + ingredient; System.out.println(); 11 18 // Second ingredient System.out.print("Ingredient #" + ++component + ": "); ????? System.out.print("How many? "); ????? System.out.print("What units? "); ????? ing2 = amount + + units + of " + ingredient; System.out.println(); 11 18 // Third ingredient System.out.print("Ingredient #" + ++component + ": "); ????? System.out.print("How many? "); ????? System.out.print("What units? "); ????? ing3 = amount + + units + of " + ingredient; System.out.println(); 11 18 // Add more code here to get fourth and fifth // ingredients, if needed. // Ask user for instructions. When user types out // instructions and presses enter, you will get them in // a string and save it to the appropriate variable System.out.println("Please enter the instructions:"); ????? System.out.println(); System.out.println("###" + title + "###"); System.out.println("Ingredients (" + component + total): "); System.out.println("* + ing1); System.out.println("* + ing2); System.out.println("* + ing3); System.out.println("Instructions: " + instructions); 11 } } Program output, when the program is run, should look something like this: What is this recipe called? Coffee Ingredient #1: instant coffee How many? 1 What units? heaping teaspoon Ingredient #2: water How many? 0.8 What units? cups Ingredient #3: milk How many? 0.2 What units? cups Please enter the instructions: Heat the water, and stir in the instant coffee and milk. ###Coffee### Ingredients (3 total): * 1.0 heaping teaspoon of instant coffee * 0.8 cups of water * 0.2 cups of milk Instructions: Heat the water, and stir in the instant coffee and milk

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!