Write a Java program that accepts the ingredients for a recipe in cups and converts to ounces. Inputs: The names of three ingredients and the number of cups for each. The ingredients are milk, flour, and sugar. Enter the first ingredient: Enter the second ingredient: Enter the third ingredient: Enter the number of cups for the first ingredient: Enter the number of cups for the second ingredient: Enter the number of cups for the third ingredient: Outputs: There will be two lines of output: The names of the ingredients in the following format. The items inside < > are variables. The recipe uses , , and 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 Step 1. Create an algorithm (either flowchart or pseudocode) that you will use to write the program. Step 2. Code the program in Eclipse to read in the ingredients and amount of each, then convert to ounces and calculate total volume. Use a printf statement to format the amount of ounces to 1 decimal place. Use this conversion formula to convert cups to ounces. 1 US cup = 8 US ounces
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Project Name: Chpt4_Project
Class Name: Chpt4_Project
Write a Java
Inputs: The names of three ingredients and the number of cups for each. The ingredients are milk, flour, and sugar.
Enter the first ingredient:
Enter the second ingredient:
Enter the third ingredient:
Enter the number of cups for the first ingredient:
Enter the number of cups for the second ingredient:
Enter the number of cups for the third ingredient:
Outputs: There will be two lines of output:
- The names of the ingredients in the following format. The items inside < > are variables.
The recipe uses <ingredient 1>, <ingredient 2>, and <ingredient 3>
- 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>
Step 1. Create an
Step 2. Code the program in Eclipse to read in the ingredients and amount of each, then convert to ounces and calculate total volume. Use a printf statement to format the amount of ounces to 1 decimal place. Use this conversion formula to convert cups to ounces.
1 US cup = 8 US ounces
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images