Question
public static void computeSD (int [ ] numbers) { int length = numbers.length; double var, sd, mean, sum, varsum; sum = 0; for (int i
public static void computeSD (int [ ] numbers)
{
int length = numbers.length;
double var, sd, mean, sum, varsum;
sum = 0;
for (int i = 0; i < length; i++)
{
sum += numbers [ i ];
}
mean = sum / (double) length;
varsum = 0;
for (int i = 0; i < length; i++)
{
varsum = varsum + ((numbers [ i ] - mean) * (numbers [ i ] - mean));
}
var = varsum / ( length - 1.0 );
sd = Math.sqrt ( var );
System.out.println ("standard deviation: " + sd);
}
Provide test inputs and expected outputs for each test path you list. If it is not possible to find the test input for certain test path, describe the reason. (2 pts.)
Hint: Not providing expected outputs will get 1 point deduction. Not matching test paths with their corresponding input/output will get 1 point deduction
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started