Computers and Technology, 12.04.2021 20:00 MyaMya12
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: \n" + 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.
Answers: 2
Computers and Technology, 23.06.2019 14:00
Technician a says that with self-adjusting clutch systems, the release bearing constantly rotates. technician b says that the ball bearing portion of the release bearing should be lubricated with high-temperature grease during routine maintenance. which technician is correct?
Answers: 2
Computers and Technology, 24.06.2019 02:30
Write the pseudo code for this problem based on what you learned from the video. the purpose is to design a modular program that asks the user to enter a distance in kilometers, and then converts that distance to miles. the conversion formula is as follows: miles = kilometers x 0.6214
Answers: 3
Computers and Technology, 24.06.2019 13:30
Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. the program should output the average high, average low, and the highest and lowest temper- atures for the year. your program must consist of the following functions: a. function getdata: this function reads and stores data in the two- dimensional array. b. function averagehigh: this function calculates and returns the average high temperature for the year. c. function averagelow: this function calculates and returns the aver- age low temperature for the year. d. function indexhightemp: this function returns the index of the highest high temperature in the array. e. function indexlowtemp: this function retur
Answers: 3
Computers and Technology, 25.06.2019 08:10
What is the requirement for self-contained recovery devices
Answers: 1
For the homework, choose a basic recipe with 3-5 ingredients and very simple instructions. Replace t...
Biology, 26.11.2019 02:31
Mathematics, 26.11.2019 02:31
Biology, 26.11.2019 02:31
Biology, 26.11.2019 02:31
Chemistry, 26.11.2019 02:31
Mathematics, 26.11.2019 02:31
Chemistry, 26.11.2019 02:31
History, 26.11.2019 02:31
Physics, 26.11.2019 02:31
Computers and Technology, 26.11.2019 02:31
Mathematics, 26.11.2019 02:31
Social Studies, 26.11.2019 02:31