jump to level 1\ncompute: answer = \\sqrt{g*h}\nex: if the input is 4.00 9.00, then the output is:\nanswer =…

jump to level 1\ncompute: answer = \\sqrt{g*h}\nex: if the input is 4.00 9.00, then the output is:\nanswer = 6.00\npublic class mathmethods {\n public static void main(string args) {\n scanner scnr = new scanner(system.in);\n double g;\n double h;\n double answer;\n\n g = scnr.nextdouble();\n h = scnr.nextdouble();\n\n /* your code goes here */\n\n system.out.printf(\answer = %.2f\\n\, answer); // outputs answer with 2 decimal places\n }\n}
Answer
Explanation:
Step1: Read input values
Let's assume the input values for (g) and (h) are read as per the code.
Step2: Calculate product
First, calculate the product of (g) and (h), i.e., (product = g\times h).
Step3: Calculate square - root
Then, find the square - root of the product. (answer=\sqrt{product}).
Answer:
The Java code to complete the calculation in line 12 would be:
answer = Math.sqrt(g * h);