Part 3 Use Eclipse to write a Java program that does the fol
Solution
import java.util.*;
import java.lang.*;
import java.io.*;
class Marks
{
public static void main (String[] args) throws java.lang.Exception
{
double[] marks = new double[100];
int i = 0;
System.out.println(\"Please enter the grades (-1 indicates the end of input)\");
while(true)
{
Scanner input = new Scanner(System.in);
double temp;
temp = input.nextDouble();
if (temp == -1)
{
break;
}
else
{
marks[i++] = temp;
}
}
System.out.println(\"Total number of grades is: \");
System.out.println(marks.length);
double sum = 0;
for (int j = 0;j < marks.length; j++)
{
sum += marks[j];
}
double mean = sum / marks.length, deviation = 0;
for (int j = 0;j < marks.length; j++)
{
deviation += ((mean - marks[j]) * (mean - marks[j]));
}
System.out.println(\"Mean: \");
System.out.println(mean);
System.out.println(\"Standard Deviation: \");
System.out.println(Math.sqrt(deviation/marks.length));
}
}

