Please help! We use Java JGrasp.
Write a Java program to take the input of 5 numbers and output the mean (average) and standard deviation of the numbers.
If the numbers are x1, x2, x3, x4, and x5, the formula for mean is
X = (x1 + x2 + x3 + x4 + x5)/5
And the formula for standard deviation is
You can also break standard deviation down like this:
1. Work out the Mean (the simple average of the numbers)
2. Then for each number: subtract the Mean and square the result
3. Then work out the mean of those squared differences.
4. Take the square root of that and we are done!
What you need to do for this lab: • Doubles will be better to use than integers. • You will need to create a method to calculate the mean and a method to calculate the standard deviation. • Use the Math.sqrt method to use squareroot.
MeanSDTest.java
import java.util.Scanner;
public class MeanSDTest {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter the 5 numbers:");
double x1= scan.nextDouble();
double x2= scan.nextDouble();
double x3= scan.nextDouble();
double x4= scan.nextDouble();
double x5= scan.nextDouble();
double mean = getMean(x1, x2, x3, x4, x5);
System.out.println("Mean: "+mean);
System.out.println("Standard Deviation: "+getStandardDeviation(mean, x1, x2, x3, x4, x5));
}
public static double getMean(double x1, double x2, double x3, double x4, double x5) {
return (x1 + x2 + x3 + x4 + x5) / 5;
}
public static double getStandardDeviation(double mean, double x1, double x2, double x3, double x4, double x5) {
double standardDeviation = 0;
standardDeviation += Math.pow(x1 - mean, 2);
standardDeviation += Math.pow(x2 - mean, 2);
standardDeviation += Math.pow(x3 - mean, 2);
standardDeviation += Math.pow(x4 - mean, 2);
standardDeviation += Math.pow(x5 - mean, 2);
standardDeviation= Math.sqrt(standardDeviation);
return standardDeviation;
}
}
Output:
Enter the 5 numbers:
3
4
5
6
7
Mean: 5.0
Standard Deviation: 3.1622776601683795
Please help! We use Java JGrasp. Write a Java program to take the input of 5...
Write a program that takes as input five numbers and outputs the mean (average) and standard deviation of the numbers. If the numbers are X_1, X_2, . X_3, X_4, X_5 then the mean is equal to X = (X_1 + X_2 + X_3+ X_4 + X_5)/5 and the standard deviation is: squareroot (Xl - X)^2 + (X2 - X)^2 + (X3 - X)^2 + (X4 - X)^2 + (X5 - X)^2 Your program must contain at least the following functions:...
4. Write a C++ program Write a program that takes as input five numbers and outputs the mean (average) and standard deviation of the numbers. If the numbers are xi, Xa, x3, Xa, and xs, then the mean is x = (Xi + X2 + X3+ X4 + Xs)/5 and the standard deviation is: Your program must contain at least the following functions: a function that calculates and returns the mean and a function that calculates the standard deviation. 30...
Write a latex solution for #2 please. 1. Use back substitution to solve each of the following systems of equations: (a) -3X2 = 2 2x2 = 6 (b) x1 +x2 +x3 = 8 2x2 + x3 = 5 3x3 = 9 (c) x1 + 2x2 + 2x3 + X4 = 3x23 2x41 4X4 = (d) X1 + X2+ X3+ X4+ X5 = 5 2x2 + X3-2x4 + X5=1 4x3 + x4-2x5 = 1 2. Write out the coefficient matrix for...
Consider an experiment in which 45 zirconium disks were divided into five groups of 9 each. Then a different contamination/cleaning protocol was used for each group. Use Tukey's procedure on the data below to identify differences in true average bond strengths (MPa) among the five protocols. (Use α = 0.05.) Treatment: 1 2 3 4 5 Sample mean 10.5 14.8 15.7 16.0 21.6 Grand mean = 15.7 Sample sd 4.2 6.8 6.2 6.9 6 MSE = 37.186 Find the value...
Need help solving a linear programming problem. Can you please use step by teps in excel solver and show work so I can follow. Thank you. Portfolio Xi= The amount of dollars to invest in stock i i=1=A, 2=B, 3=C, 4=D, 5=E Max Expected Return Z=4.5X1+5.2X2+6.0X3+7.2X4+4.2X5 Subject to: X1+X3<=50,000 X2+X5<=50,000 X4<=50,000 X1>=20,000 X3<=0.2(X1+X3) X1+X2+X3+x4+X5<=100,000 Xi>=0 for all i
I need help on the knapsack lp by using branch and bound ) Use the branch-and-bound method to find the optimal solution to the ollowing IP: Minimize 9x1 +13x2 +10x3 +8x4 +8x5 s.t.6x1+3x2+2x3+4x4+7x5240 X131,x221,x322,x421,x5s3 X1, X2, X3, X4, X5 20 integer ) Use the branch-and-bound method to find the optimal solution to the ollowing IP: Minimize 9x1 +13x2 +10x3 +8x4 +8x5 s.t.6x1+3x2+2x3+4x4+7x5240 X131,x221,x322,x421,x5s3 X1, X2, X3, X4, X5 20 integer
All Greens is a franchise store that sells house plants and lawn and garden supplies. Although All Greens is a franchise, each store is owned and managed by private individuals. Some friends have asked you to go into business with them to open a new All Greens store in the suburbs of San Diego. The national franchise headquarters sent you the following information at your request. These data are about 27 All Greens stores in California. Each of the 27...
All Greens is a franchise store that sells house plants and lawn and garden supplies. Although All Greens is a franchise, each store is owned and managed by private individuals. Some friends have asked you to go into business with them to open a new All Greens store in the suburbs of San Diego. The national franchise headquarters sent you the following information at your request. These data are about 27 All Greens stores in California. Each of the 27...
X is a Discrete Random Variable that can take five values Given The five possible values are: x1 = 4 (Units not given) X2 = 6 (Units not given) X3 = 9 (Units not given) X4 = 12 (Units not given) X5 = 15 (Units not given) The associated probabilities are: p(x1) = 0.14 (Unitless) p(x2) = 0.11 (Unitless) p(x3) = 0.10 (Unitless) p(xx) = 0.25 (Unitless) Question(s) 1. If the five values are collectively exhaustive, what is p(x5)? (Unitless)...
LANGUAGE IS JAVA CALCULATOR USING SCIENTIFIC/STANDARD MODE ERRORS: ADDITION AND DIVISION NOT WORKING FOR EITHER CALCULATOR CODE: import java.util.Scanner; public class CalculatorProject { public static void main (String[] args) { Scanner yurr = new Scanner(System.in); String mode; double i; String choice; String answer = "Y"; while (answer.equals("Y")) { System.out.println("Enter the calculator mode: Standard/Scientific?"); mode = yurr.next(); if(mode.equals("Scientific")) { System.out.print("Enter '+' for addition, '-' for subtractions, '*' for multiplication, '/' for division, 'sin' for sin x, 'cos' for cos x,...