裁判打分用Java程序怎么写

裁判打分用Java程序怎么写
2024-12-21 13:13:29
推荐回答(2个)
回答1:

public class Person {
private String name;
private int fen;
public Person(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void SetName(String name) {
this.name=name;
}
public int getFen() {
return fen;
}
public void SetFen(int fen) {
this.fen = fen;
}
}
public class DaFen{
private Person person;
public int cpDaFen(String name , int fen) {
if(person == null) {
person = new Person(name);
person.setFen(fen);
}
}
}

回答2:

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Test {

public static void main(String[] args) {
Scanner s = new Scanner(System.in);
List list = new ArrayList();
for (int i = 0; i < 10; i++) {
list.add(s.nextInt());
}
list.remove(Collections.max(list));
list.remove(Collections.min(list));
int sum = 0;
for (int i = 0; i < list.size(); i++) {
sum += list.get(i);
}
System.out.println(sum / 8);
}
}