-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentClubMember.java
More file actions
49 lines (39 loc) · 1.1 KB
/
Copy pathStudentClubMember.java
File metadata and controls
49 lines (39 loc) · 1.1 KB
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
public class StudentClubMember {
String clubName;
public StudentClubMember(String clubName) {
this.clubName = clubName;
}
public String getClubName() {
return clubName;
}
public static void main(String[] args) {
Student student = new Student("Ashish", "Coding Club", "CS261");
student.displayInfo();
}
}
class CollegeCourse {
String courseName;
public CollegeCourse(String courseName) {
this.courseName = courseName;
}
public String getCourseName() {
return courseName;
}
}
class Student extends StudentClubMember {
String name;
CollegeCourse courseName;
public Student(String name, String clubName, String courseName) {
super(clubName);
this.name = name;
this.courseName = new CollegeCourse(courseName);
}
public String getName() {
return name;
}
public void displayInfo() {
System.out.println("Name: " + getName());
System.out.println("Club Name: " + getClubName());
System.out.println("Course Name: " + courseName.getCourseName());
}
}