Hi, I have to code a java program that accepts the ingredients for a recipe in cups and converts to ounces.   I started off coding but I got stuck. I need to know if I'm on the right track or not.    import java.util.Scanner;   public class Chp4_Project {   public static void main(String[] args)   { Scanner input = new Scanner(System.in);   System.out.print("Enter the first ingredient: "); String ingred1 = input.nextLine();   System.out.print("Enter the second ingredient: "); String ingred2 = input.nextLine();   System.out.print("Enter the third ingredient: "); String ingred3 = input.nextLine();      Our input is to name three ingredients and the number of cups for each.    And then the output should have two lines of : 1. The names of the ingredients in the following format. The items inside < > are variables. The recipe uses <ingredient 1>, <ingredient 2>, and <ingredient 3> 2. The total volume of all three ingredients in ounces in the following format. The item inside < > is a variable. The total amount of the recipe in ounces is <total ounces>     I really want to understand and get this without seeming like I'm only looking for the answers.

Question

Hi, I have to code a java program that accepts the ingredients for a recipe in cups and converts to ounces.

 

I started off coding but I got stuck. I need to know if I'm on the right track or not. 

 

import java.util.Scanner;
 
public class Chp4_Project
{
 
public static void main(String[] args)
 
{
Scanner input = new Scanner(System.in);
 
System.out.print("Enter the first ingredient: ");
String ingred1 = input.nextLine();
 
System.out.print("Enter the second ingredient: ");
String ingred2 = input.nextLine();
 
System.out.print("Enter the third ingredient: ");
String ingred3 = input.nextLine();
 
 

 Our input is to name three ingredients and the number of cups for each. 

 

And then the output should have two lines of :

1. The names of the ingredients in the following format. The items inside < > are variables.
The recipe uses <ingredient 1>, <ingredient 2>, and <ingredient 3>
2. The total volume of all three ingredients in ounces in the following format. The item inside < > is a variable.
The total amount of the recipe in ounces is <total ounces>
 
 
I really want to understand and get this without seeming like I'm only looking for the answers. 

Expert Answer

1 Rating

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times vary by subject and question complexity. Median response time is 34 minutes and may be longer for new subjects.

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: I am changing careers and avoided math my entire academic life. Can you please tell me what math is ...

A: Importance of math in web development:For beginners, both arithmetic and basic algebra should be min...

Q: in python Create a new Python program (you choose the filename) that contains a main function and an...

A: Create a main function in the program.Create an empty list, the name of the list is randomNumber.Use...

Q: Recall the following code, which we examined in class.v o i d f o r k t e s t ( ){p r i n t f ( ” mo...

A: The sample output of the given program is:

Q: Code should be in C++ Absolute Value Template: Write a function template that accepts an argument an...

A: Since Function Templates are used to handle all possible data types you can say generic data type at...

Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles...

A: Program Instructions:Take car's miles/gallon and gas dollars/gallon as input using scanner class.Cal...

Q: 1. /15 points] Consider the following function: Func1(A, n) * A is an array of integers 1 80; 2 for ...

A: a)Worst case running time of Func1:The random number between 1 to “n” is assigned to “k” in the give...

Q: Using the following truth table, write the equivalent Boolean equations in Sum of Product and Produc...

A: Simplification of Sum Of Products (SOP):The truth table of the SOP is as follows

Q: The following data fragment occurs in the middle of a data stream for which the byte-stuffing algori...

A: Byte stuffing algorithm, also referred as Character stuffing algorithm was invented to overcome the ...

Q: What are some apps you use regularly? Why? What makes you choose to use them over other apps that do...

A: There are many apps that we use regularly. The most commonly used apps includes the following:Educat...