public class Student{ private String name; private String sex; private int score_java; private int score_c; private int score_php; void averagescore() { int sum = 0; int average = 0; sum += score_java+score_c+score_php; average = sum/3; System.out.println("总分:" + sum); System.out.println("平均分:" + average); } void maxminscore() { int temp = 0; int max = 0; int min = 0; temp = score_java; if(temp
public class Student{
private String name;
private String sex;
private int score_java;
private int score_c;
private int score_php;
void averagescore() {
int sum = 0;
int average = 0;
sum += score_java+score_c+score_php;
average = sum/3;
System.out.println("总分:" + sum);
System.out.println("平均分:" + average);
}
void maxminscore() {
int temp = 0;
int max = 0;
int min = 0;
temp = score_java;
if(temptemp = score_c;
esle min = score_c;
if(temptemp = score_php;
else if(min>score_php)
min = score_php;
max = temp;
System.out.println(" 最高分:" + max);
System.out.println(" 最低分:" + min);
}
}
稍微排了排版,看着能舒服点。