Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Java student number shaping
Java student number shaping
Import? Java . util . scanner;

Public? Class? Student? {

Public? Static electricity Invalid? main(String[]? args)? {

int? total student = 3;

String[]? ID? =? New? string[total student];

String[]? stuName? =? New? string[total student];

double[]? java? =? New? double[total student];

double[]? English? =? New? double[total student];

double[]? Math? =? New? double[total student];

double[]? averageScore? =? New? double[total student]; ?

Scanner? sc? =? New? Scanner (system. in);

for(int? I = 0; I< the total number of students; i++){

System.out.println ("please enter" +(i+ 1)+ "student number");

ID[I]= sc . next();

System.out.println ("Please enter" +(i+ 1)+ "student name");

stuName[I]= sc . next();

System.out.println ("Please enter" +(i+ 1)+ "Students' java programming scores");

Java[I]= sc . next double();

System.out.println ("Please enter" +(i+ 1)+ "Student's university? English scores ");

English[I]= sc . next double();

System.out.println ("Please enter" +(i+ 1)+ "Advanced Mathematics for students");

maths[I]= sc . next double();

Averages core[I]=(Java[I]+ English [I]+ Mathematics [I])/3;

}

while(true){

System.out.println ("Please enter a search method (1. According to the student number; 2 according to the name), enter 3 to exit ");

String? Type? =? sc . next();

int? index =- 1;

int? Rank? =? 1;

if(" 1 "。 Equal to (type)) {

System.out.println ("Please enter the student ID");

String? id? =? sc . next();

for(int? I = 0; I & ltID. Length; i++){

if(ID . equals(ID[I]){

index = I;

Break;

}

}

} something else? if("2 "。 Equal to (type)) {

System.out.println ("Please enter the name of the student you are looking for");

String? Name? =? sc . next();

for(int? I = 0; I & ltID. Length; i++){

if(name . equals(ID[I]){

index = I;

Break;

}

}

} something else? if("3 "。 Equal to (type)) {

System.out.println ("End of program!" );

Break;

} Otherwise {

System.out.println ("Input error!" );

Continue;

}

if(index==- 1){

System.out.println ("Sorry, not found");

} Otherwise {

for(int? I = 0; I & ltaverageScore.lengthi++){

if(averages core[I]& gt; averageScore[index]){

Rank++;

}

}

System.out.println ("student number:"+ID [index]);

system . out . println(" name:"+stuName[index]);

System. Out.println ("Java programming achievement: "+Java [index]);

System.out.println ("University? English score: "+English [index]);

System.out.println ("Advanced Mathematics:"+Maths [index]);

System.out.println ("average score of three courses:"+averages core [index]);

system . out . println(" ranking:"+ranking);

}

}

}

} I actually answered it once before ╮ (╯ _ ╰) ╭.