评测状态 System Error ><

代码

import java.util.Scanner;
import java.lang.String;

class Test {

public static void main (String[] args)
{
Test test = new Test();
test.go();

}

public void go(){
int totalStudent;
int i = 0;
int position = 0;// position of student with largest money
int totalM = 0; //total money
int largestM = 0; //money of largest student
Scanner in = new Scanner(System.in);
totalStudent = in.nextInt();

Student[] allStudent = new Student[totalStudent];
while (i<totalStudent)
{
allStudent[i] = new Student (0,in.next(),in.nextInt(),in.nextInt(),in.next().charAt(0),in.next().charAt(0),in.nextInt());
i++;
}
in.close();

for (int j=0;j<totalStudent;j++){
int M = allStudent[j].calculate();
totalM += M;
if (M>largestM)
{
position = j;
largestM = M;
}

}
System.out.println(allStudent[position].name);
System.out.println(largestM);
System.out.println(totalM);

}

class Student {
int total;
String name;
int score1;
int score2;
char leader;
char west;
int paper;
Student (int total, String name, int score1, int score2, char leader, char west, int paper){
this.total = total;
this.name = name;
this.score1 = score1;
this.score2 = score2;
this.leader = leader;
this.west = west;
this.paper = paper;

}

public int calculate(){

total = 0;
if (score1>80 && paper>=1)
total += 8000;
if (score1>85 && score2>80)
total += 4000;
if (score1>90)
total += 2000;
if (score1>85 && west == 'Y')
total += 1000;
if (score2>80 && leader == 'Y')
total += 850;
return total;
}
public String toString()
{
return name + " " + score1 + " " + score2 + " " + leader +" "+ west+" " + paper;

}
}

}

1 条评论

  • @ 2014-11-17 20:40:22

    类名要是Main

    不好意思 回复迟了

  • 1

信息

ID
1001
难度
5
分类
模拟 点击显示
标签
递交数
39307
已通过
12806
通过率
33%
被复制
132
上传者