Answer:
// This program is written in Java Programming Language
// Comments are used for explanatory purpose
// Program starts here
import java.util.Scanner;
public class STDeviation {
// Declare and Initialise size of Numbers to be 10
int Numsize = 10;
public static void main(String args [] ) {
Scanner scnr = new Scanner(System.in);
// Declare digits as double
double[] digits = new double[Numsize];
System.out.print("Enter " + Numsize + " digits: ");
// Input digits using iteration
for (int i = 0; i < digits.length; i++)
{
digits[i] = scnr.nextDouble();
}
// Calculate and Print Mean/Average
System.out.print("Average: " + mean(digits)+'\n');
// Calculate and Print Standard Deviation
System.out.println("Standard Deviation: " + deviation(digits));
}
// Standard Deviation Module
public static double deviation(double[] x) {
double mean = mean(x);
// Declare and Initialise deviation to 0
double deviation = 0;
// Calculate deviation
for (int i = 0; i < x.length; i++) {
deviation += Math.pow(x[i] - mean, 2);
}
// Calculate length
int len = x.length - 1;
return Math.sqrt(deviation / len);
}
// Mean Module
public static double mean(double[] x) {
// Declare and Initialise total to 0
double total = 0;
// Calculate total
for (int i = 0; i < x.length; i++) {
total += x[i];
}
// Calculate length
int len = x.length;
// Mean = total/length
return total / len;
}
}