Question: MeanOfThree.java: 9 : error: cannot find symbol double val 1 = scn . nextDouble ( ) ; ^ symbol: variable scn location: class MeanOfThree MeanOfThree.java:

MeanOfThree.java:9: error: cannot find symbol
double val1= scn.nextDouble();
^
symbol: variable scn
location: class MeanOfThree
MeanOfThree.java:12: error: cannot find symbol
double val2= scn.nextDouble();
^
symbol: variable scn
location: class MeanOfThree
MeanOfThree.java:15: error: cannot find symbol
double val3= scn.nextDouble();
^
symbol: variable scn
location: class MeanOfThree
3 errors
What exactly do I do in this circumstance? The mean of three numbers, num1, num2, and num3, is given by meanOfThree =(num1+3.0
um2+
um3). Read
double variables num1, num2, and num3 from input, respectively. Then, compute meanOfThree using the formula. Finally, output
"Mean is " followed by the value of meanOfThree to four digits after the decimal point. End with a newline.
Ex: If the input is 21.015.018.0, then the output is:
Mean is 18.0000
Note: printf() can be used with "%.4f" to output a double to 4 digits after the decimal point.
// User enters 3 numbers and read input as val
system.out.println("Enter first number:");
double val1= scn.nextDouble();
System.out.println("Enter second number:");
double val2= scn.nextDouble();
System.out.println("Enter third number:");
double val3= scn.nextDouble();
// Calculte the mean of the three numbers
double meanOfThree =(val1+ val2+ val3)/3.0;
// Print the mean value formatted to four decimal places
System.out.printf("Mean is %.4f
", meanOfThree);
}
}
MeanOfThree.java: 9 : error: cannot find symbol

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 Programming Questions!