查看: 630|回复: 0
|
java program
[复制链接]
|
|
package Assignment;
import java.io.*;
import java.lang.Math;
public class TestRun1 {
public static void main (String[]args) throws IOException {
InputStreamReader reader = new InputStreamReader (System.in);
BufferedReader input = new BufferedReader(reader);
String text;
int n;
double xxx;
System.out.println("Enter the sample saiz");
text = input.readLine();
n =Integer.parseInt(text);
double [] xx = new double[n];
Double x;
for (int i=0; i<n; i++)
{
System.out.print("Input x["+i+"] = ");
text = input.readLine();
x=new Double(text);
xx = x.doubleValue();
System.out.println("x["+i+"] = "+xx);
}
System.out.println("Enter the mean population");
text = input.readLine();
x =new Double(text);
xxx = x.doubleValue();
double vn, sumx, sumxsq,stddev, xbar;
sumx =0;
sumxsq=0;
vn=n;
for(int i=0;i<xx.length; i++)
{
sumx = sumx + xx;
sumxsq = sumxsq + Math.pow(xx,2);
}
xbar = sumx/vn;
stddev=Math.sqrt((sumxsq-vn*xbar*xbar)/(vn-1.0));
System.out.println("sum x = " +sumx);
System.out.println("Stddev = " +stddev) ;
try {System.in.read();}
catch (Exception e) {}
}
}
上面是我做到一半的program
请问谁会做接下来的java program
题目如下:
Hypothesis testing
In the java program, u should able to
a) read sample size and data from keyboard
b) read mean population from keyboard
c) read the level of significant from keyboard
d) perform 1 or 2 tailed tests
e) select in between normal or t-distribution
f) calculate the test statistic and p-value
g) test the hypothesis whether to reject or do not reject H◦ at the significant level and print the result onto the screen |
|
|
|
|
|
|
| |
本周最热论坛帖子
|