- 谁拿了最多奖学金
- 2016-11-12 17:45:16 @
import java.io.IOException;
import java.util.*;
public class Main {
public static void main(String args[]) throws IOException{
Scanner in=new Scanner(System.in);
String nameString;
int grade;
int classGrade;
String isWestern;
String isCadres;
int essayNum;
String name=null;
int Max=0;
int total=0;
int tempNum=0;
int n;
n=in.nextInt();
for(int i=0;i<n;i++){
nameString=in.next();
grade=in.nextInt();
classGrade=in.nextInt();
isCadres=in.next();
isWestern=in.next();
essayNum=in.nextInt();
StudentInfo temp=new StudentInfo(nameString, grade, classGrade, isWestern, isCadres, essayNum);
tempNum=temp.getAmount();
if(tempNum>Max){
Max=tempNum;
name=nameString;
}
total+=tempNum;
}
System.out.println(name);
System.out.println(Max);
System.out.print(total);
}
public static class StudentInfo {
private String name;
private int grade;
private int classGrade;
private String isWestern;
private String isCadres;
private int essayNum;
public StudentInfo(String name,int grade,int classGrade,String isWestern,String isCadres,int essayNum){
this.name=name;
this.grade=grade;
this.classGrade=classGrade;
this.isCadres=isCadres;
this.isWestern=isWestern;
this.essayNum=essayNum;
}
public String getName(){
return this.name;
}
public int getAmount(){
int sum=0;
if (grade > 80){
if (essayNum >= 1){
sum += 8000;
}
if (grade > 85){
if (classGrade > 80){
sum += 4000;
}
if (isWestern.equals("Y")){
sum += 1000;
}
if (grade > 90){
sum += 2000;
}
}
}
if (classGrade > 80&&isCadres.equals("Y")){
sum += 850;
}
return sum;
}
}
}
1 条评论
-
_YangHao LV 4 @ 2016-11-15 19:51:08
printf("hhh");
- 1