Question: 1.Create a project in Eclipse called P2. 2.Create a class in the project called P2. 3.Let Eclipse create a main method in P2.java. 4.Copy the

1.Create a project in Eclipse called P2.

2.Create a class in the project called P2.

3.Let Eclipse create a main method in P2.java.

4.Copy the comment block below and personalize it

All variables and code should reside in the main method!

5.Declare variables named alphaAcid, ounces, weight, lovibond, and volume of type double.

6.Create a Scanner object to read console input, as shown in the code below.

7.Prompt the user for an Alpha Acid %, by printing "Alpha Acid? " using System.out.print().

8.Read the number entered by the user into the alphaAcid variable using the Scanner method nextDouble().

9.Prompt the user for a weight in ounces, by printing "Ounces? " using System.out.print().

10.Read the number entered by the user into the ounces variable using the Scanner method nextDouble().

11.Compute the HBUs based on the following formula: HBUs = alphaAcid * ounces.

12.Print the HBUs to the console using System.out.printf(), with 2 digits after the decimal point.

13.As before, prompt the user for a values for the remaining 3 variables using System.out.print() (see below for exact prompts to use!).

14.Read the numbers entered by the user into the appropriate variables using the Scanner method nextDouble().

15.Compute the SRM using Mosher's formula:

16. SRM = (0.3 * weight * lovibond / volume) + 4.7

17 Remember to use the volume variable here and not the ounces variable from before!

18.Print the SRM value to the console using System.out.printf(), with 4 digits after the decimal point.

19.The sample output below shows the desired format.

// P2 Assignment Solution // Author: // Date: // Class: // Email: import java.util.Scanner; public class P2 { public static void main(String[] args) { // Declare variables for mysterious formulas // Instantiate scanner Scanner keyboard = new Scanner(System.in); // Prompt and read alphaAcid from keyboard // Prompt and read ounces from keyboard // Calculate HBUs // Print HBUs to console // Prompt and read remaining variables // Compute the SRM value using the formula // Print SRM to console // Close scanner keyboard.close(); }

sample output is down below.

Alpha Acid? 5.0 Ounces? 2.0 The HBUs are 10.00. Weight? 1.0 Lovibond? 80.0 Volume? 5.0 The SRM value is 9.5000.

I finished until step 4.

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!