package kr.ac.jj.java201812345;
import java.util.Scanner;
public class HighStudentChild extends HighStudent{
public int sci;
public HighStudentChild() {
}
public HighStudentChild(int kor, int eng, int mat, int sci) {
super(kor, eng, mat);
this.sci = sci;
}
public HighStudentChild(String name, int kor, int eng, int mat, int sci) {
super(name, kor, eng, mat);
this.sci = sci;
}
public void Calc() {
this.tot = kor + eng + mat + sci;
this.ave = this.tot / 4.0;
if(this.ave >= 90) {
this.grade = "수";
}
else if(this.ave >= 80) {
this.grade = "우";
}
else if(this.ave >= 70) {
this.grade = "미";
}
else if(this.ave >= 60) {
this.grade = "양";
}
else{
this.grade = "가";
}
}
public void Input() {
Scanner scan = new Scanner(System.in);
System.out.print("이름 : ");
this.name = scan.nextLine();
System.out.print("국어 : ");
this.kor = scan.nextInt();
System.out.print("영어 : ");
this.eng = scan.nextInt();
System.out.print("수학 : ");
this.mat = scan.nextInt();
System.out.print("과학 : ");
this.sci = scan.nextInt();
this.Calc();
}
public void Print() {
System.out.println(
"이름 : " + this.name
+ "\t국어 : " + this.kor
+ "\t영어 : " + this.eng
+ "\t수학 : " + this.mat
+ "\t과학 : " + this.sci
+ "\t총점 : " + this.tot
//+ "\t평균 : " + this.ave
+ "\t평균 : " + String.format("%6.2f", this.ave)
+ "\t등급 : " + this.grade
);
}
}