在这里插入代码片
```public class Shuzu {
public double calArg(int[]scores) {
int sum=0;
double avg;
for(int i=0;i<scores.length;i++) {
sum+=scores[i];
}
avg=(double)sum/scores.length;
return avg;
}
public double calMax(int[] scores) {
double max=scores[0];
for(int i=0;i<scores.length;i++) {
if(max<scores[i]) {
max=scores[i];
}
}
return max;
}
}
```java
在这里插入代码片
```public class Shuchu {
public static void main(String[] args) {
Shuzu su=new Shuzu();
Scanner input=new Scanner(System.in);
int[] scores=new int[5];
System.out.println("请输入五名参赛者的成绩:");
for(int i=0;i<scores.length;i++) {
scores[i]=input.nextInt();
}
double avgs=su.calArg(scores);
double max=su.calMax(scores);
su.calMax(scores);
System.out.println("平均分:"+avgs);
System.out.println("最高成绩:"+max);
}
}