-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCourse.java
103 lines (89 loc) · 2.26 KB
/
Course.java
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
package Codes;
public class Course {
private String cId;
private String cTitle;
private double credit;
private Student[] slist= new Student[10];
private int numberofStudents;
private Faculty faculty;
public Course[] cos= new Course[10];
public int numberofCourse;
Course()
{
}
Course(String cID, String cTitle, double credit )
{
this.cId=cID;
this.cTitle=cTitle;
this.credit=credit;
}
@Override
public String toString() {
return "Course Id :" +cId + " Course-Title : " +cTitle+ " Course-credit : " +credit ;
}
public void addCourse(Course c)
{
cos[numberofCourse++]=c;
}
public void addStudent(Student s)
{
slist[numberofStudents++]=s;
}
public void addFaculty(Faculty f)
{
this.faculty=f;
}
public void dropstudent(int stdId)
{
for(int i=0;i<numberofStudents;i++)
{
if(stdId==slist[i].getstdId())
{
for(int j=0;j<numberofStudents;j++)
{
slist[i]=slist[i+1];
}
numberofStudents--;
}
}
}
public void dropfaculty()
{
faculty=null;
}
public void searchStudent(int stdId)
{
for(int i=0;i<numberofStudents;i++)
{
if(stdId==slist[i].getstdId())
{
System.out.println("**** **** **** **** ");
System.out.println(slist[i].toString());
System.out.println("**** **** **** **** ");
}
}
}
public void printStudentinfo()
{
for(int i=0;i<numberofStudents;i++)
{
System.out.println("----------- ---- --- ---- ----- --- ---- ---- -- -----------");
System.out.println(slist[i].toString());
}
}
public void prinCourseinfo()
{
for(int i=0;i<numberofCourse;i++)
{
System.out.println(this.cos[i].toString());
}
}
public void printFacultyinfo()
{
for(int i=0;i<numberofStudents;i++)
{
System.out.println("------- -------- ------- ------- ------ -------");
System.out.println(this.faculty.toString());
}
}
}