[자료구조]학생 성적관리 프로그램(JAVA)
류명운
·2014. 6. 28. 01:34
수업 중 과제로 내주신 학생 성적관리 프로그램 작성내용 입니다.
참고하시어 열공하시기 바랍니다.
class StudentInfo{ protected String dept, stdNo, name 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 kor, eng, math, sum 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(); } } |
|
'삶의 늪에 들어 가기 전 > 정리중(미정리)' 카테고리의 다른 글
[자료구조]교재 솔루션 - JAVA로 배우는 자료구조 (0) | 2014.06.28 |
---|---|
[자료구조]2차원 배열 사용하기(JAVA) (0) | 2014.06.28 |
[자료구조]구구단 출력하기 프로그램(JAVA) (0) | 2014.06.28 |
[프로그래밍 응용 및 실습]기말고사 실기 시험 제출 파일 (0) | 2014.06.28 |
[프로그래밍 응용 및 실습]중간고사 실기 시험 제출 파일 (0) | 2014.06.28 |