[자료구조]학생 성적관리 프로그램(JAVA)

류명운

·

2014. 6. 28. 01:34

반응형

수업 중 과제로 내주신 학생 성적관리 프로그램 작성내용 입니다.


참고하시어 열공하시기 바랍니다.


class StudentInfo{

protected String deptstdNoname

StudentInfo(String dept, String stdNo, String name){

this.dept = dept;

this.stdNo = stdNo;

this.name = name;

}

public void getStdInfo(){

System.out.println("** 학생정보출력**");

System.out.println("학과: " dept);

System.out.println("학번: " stdNo);

System.out.println("이름: " name);

}


class StudentScore extends StudentInfo{private int korengmathsum

private double ave

StudentScore(String dept, String stdNo, String name,int kor, int eng, int math){

super(dept, stdNo, name);

this.kor = kor;

this.eng = eng;

this.math = math;

this.sum = 0;

this.ave = 0.0;

}

public int getSum(){

sum kor eng math

return sum

}

public double getAve(){

ave sum/3.0;

return ave

}

public void getStdInfo(){

super.getStdInfo();

}

public void getStdScore(){

System.out.println("** 학생점수출력**");

System.out.println("국어: " kor);

System.out.println("영어: " eng);

System.out.println("수학: " math);

System.out.println("총점: " + getSum());

System.out.println("평균: " + getAve());

}

}


class Ex_Student{

public static void main(String args[]){

StudentInfo s_i = new StudentInfo("컴퓨터과학","20072135","홍길동");

StudentScore s_s = new StudentScore("컴퓨터과학과", "20072140","홍길순",91,80,95);

s_i.getStdInfo(); System.out.println();

s_s.getStdInfo();

s_s.getStdScore();

}

}

 



반응형