Candidates class

package paet02;

{class ExampleDemo01 public
public static void main (String [] args) {
Student Student new new STU = ( "MLDN-33 is", "Li Xinghua", 95F, 92.0f, 93.0f);
System.out.println ( "student number : "+ stu.getStuno ());
System.out.println (" student name: "+ stu.getName ());
System.out.println (" math: "+ stu.getMath ());
System. out.println ( "English results:" + stu.getEnglish ());
System.out.println ( "computer performance:" + stu.getComputer ());
System.out.println ( "highest score:" + stu. max ());
System.out.println ( "minimum score:" + stu.min ());
System.out.println ( "Total:" + stu.sum ());
System.out.println ( "average points: "+ stu.avg ());
}

}

class Student{
private String stuno;
private String name;
private float math;
private float english;
private float computer;
public String getStuno() {
return stuno;
}
public void setStuno(String stuno) {
this.stuno = stuno;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public float getMath() {
return math;
}
public void setMath(float math) {
this.math = math;
}
public float getEnglish() {
return english;
}
public void setEnglish(float english) {
this.english = english;
}
public float getComputer() {
return computer;
}
public void setComputer(float computer) {
this.computer = computer;
}
public Student() {

}
public Student(String stuno, String name, float math, float english,
float computer) {
setMath(math);
setEnglish(english);
setComputer(computer);
setName(name);
setStuno(stuno);
}
public float sum(){
return math + english + computer;
}
public float avg(){
return (math + english + computer)/3;
}
public float max(){
float max = math;
max = max > english ? max : english;
max = max > computer ? max : computer;
return max;
}
public float min(){
float min = math;
min = min < english ? min : english;
min = min <computer? my computer;
Return min;
}
}

Guess you like

Origin www.cnblogs.com/wazl/p/11671417.html