Class/220728
Class(2-2)
by pms93
2022. 7. 28.
package constructor;
public class Student {
private String name;
private int kor, eng, mat, total;
private double avg;
public Student(String name, int kor, int eng, int mat) {
this.name = name;
this.kor = kor;
this.eng = eng;
this.mat = mat;
}
public String getName() {
return name;
}
public int getKor() {
return kor;
}
public int getTotal() {
setTotal();
return total;
}
private void setTotal() {
this.total = this.kor + this.mat + this.eng;
}
public double getAvg() {
return getTotal() / 3.0;
}
public int getEng() {
return eng;
}
public int getMat() {
return mat;
}
}