Power java 11장 Programming 7번문제 풀이

Posted by Nalra
2016.04.12 15:51 Java/PowerJava 문제풀이




※ 문제풀이는 작성자 본인이 직접 한것이므로 정답이 아닐 수 있습니다.

   혹시 보시고 틀린 부분이 있으면 알려주시기 바랍니다.

 문제는 책을 참고하시기 바랍니다.

 

7번 문제풀이

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package day09;
 
class Student11{
    String name, number, major,grade,score;
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public String getNumber() {
        return number;
    }
 
    public void setNumber(String number) {
        this.number = number;
    }
 
    public String getMajor() {
        return major;
    }
 
    public void setMajor(String major) {
        this.major = major;
    }
 
    public String getGrade() {
        return grade;
    }
 
    public void setGrade(String grade) {
        this.grade = grade;
    }
 
    public String getScore() {
        return score;
    }
 
    public void setScore(String score) {
        this.score = score;
    }
    
    
}
//String name, number, major,grade,score;
class UnderGraduate extends Student11{
    String club;
    
    public UnderGraduate(String name, String number, String major,String grade,String score,String club) {
        this.name = name;
        this.number = number;
        this.major = major;
        this.grade = grade;
        this.score = score;
        this.club = club;
    }
    public String getClub() {
        return club;
    }
 
    public void setClub(String club) {
        this.club = club;
    }
    public void print(){
        System.out.println(name+","+number+","+major+","+grade+","+score+","+club);
    }
}
class Graduate extends Student11{
    String assistant;
    String scholarship;
    public String getAssistant() {
        return assistant;
    }
    public void setAssistant(String assistant) {
        this.assistant = assistant;
    }
    public String getScholarship() {
        return scholarship;
    }
    public void setScholarship(String scholarship) {
        this.scholarship = scholarship;
    }
    public Graduate(String name, String number, String major,String grade,String score,String assistant,String scholarship) {
        this.name = name;
        this.number = number;
        this.major = major;
        this.grade = grade;
        this.score = score;
        this.assistant = assistant;
        this.scholarship = scholarship;
    }
    public void print(){
        System.out.println(name+","+number+","+major+","+grade+","+score+","+assistant+","+scholarship);
    }
    
}
public class Programming11_7 {
    public static void main(String[] args) {
        UnderGraduate u1 = new UnderGraduate("유시진""20130232""컴공""3""120""사격동아리");
        Graduate g1 = new Graduate("강모연""20082323""의학과""1""30""조교임""받음");
        
        u1.print();
        g1.print();
    }
}
 
 
cs

 

신고
이 댓글을 비밀 댓글로