import java.io.*;
public class JudgeGrame {
public static void main(String[] args) {
Judge cc = new Judge();
cc.PrivageFen();
}
}
class Judge{
float[] ff = null;
int size = 5;
//构造函数初始化数组,初始化输入值
public Judge() {
ff = new float[size];
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader bf = new BufferedReader(isr);
try {
for(int i = 0; i < ff.length; i++) {
System.out.println(“请输入第” +( i+1) + “个学生的分数”);
ff[i] = Float.parseFloat(bf.readLine());
}
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
finally{
try {
bf.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public int minf() {
float minff = ff[0];
int mindex = 0;
for(int i = 0; i < ff.length; i++) {
if(ff[i] < minff) {
minff = ff[i];
mindex = i;
}
}
return mindex;
}
public int maxf() {
float maxff = ff[0];
int maxdex = 0;
for(int i = 0; i < ff.length; i++) {
if(ff[i] < maxff) {
maxff = ff[i];
maxdex = i;
}
}
return maxdex;
}
public float PrivageFen() {
int mindex = this.minf();
int maxdex = this.maxf();
float allF = 0;
for (int i = 0; i < ff.length - 2; i++) {
if (i!= mindex && i!= maxdex) {
allF = allF + ff[i];
}
}
return allF/(ff.length - 2);
}
}