import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double []a=new double[6];
for(int i=0;i<6;i++) {
a[i]=input.nextDouble();
}
MyMath mymath1 =new MyMath();
System.out.println("数值和为"+mymath1.sum(a)+"n平均值为"+mymath1.mean(a));
}
static class MyMath{
public static double sum(double []x) {
double sum=0;
for(int i=0;i
sum=sum+x[i];
}
return sum;
}
}
public double mean(double []x) {
double sum=0;
for(int i=0;i
sum=sum+x[i];
}
return sum/x.length;
}
}
生地会考都看得见电脑版手机
import java.util.Scanner;
public class TestMyMath {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double []a=new double[6];
for(int i=0;i<6;i++) {
a[i]=input.nextDouble();
}
MyMath mymath1 =new MyMath();
System.out.println("数值和为"+mymath1.sum(a)+"n平均值为"+mymath1.mean(a));
}
static class MyMath{
public static double sum(double []x) {
double sum=0;
for(int i=0;i
sum=sum+x[i];
}
return sum;
}
}
public double mean(double []x) {
double sum=0;
for(int i=0;i
sum=sum+x[i];
}
return sum/x.length;
}
}



