- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourse.java
More file actions
Latest commit
68 lines (62 loc) · 1.79 KB
/
Copy pathCourse.java
File metadata and controls
68 lines (62 loc) · 1.79 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
importjava.util.ArrayList;
importjava.util.List;
publicclassCourse {
Stringname;
Stringprofes;
intmax;
Stringd;
intyr;
Stringother;
List<String> studenrolled = newArrayList<String>();
publicCourse(Stringc_name,intmax,Stringprof,Stringd,intyr){
this.name = c_name;
this.profes = prof;
this.max = max;
this.d = d;
this.yr = yr;
this.other = null;
}
publicCourse(Stringc_name,intmax,Stringprof,Stringd,intyr,Stringn){
this.name = c_name;
this.profes = prof;
this.max = max;
this.d = d;
this.yr = yr;
this.other = n;
}
publicstaticvoidmodify(Stringa,intnewmax,Stringnewprof){
intcidx=0;
for(inti=0;i<Index.c.size();i++){
if(Index.c.get(i).name.equals(a)){
cidx=i;
break;
}
}
Index.c.get(cidx).max = newmax;
Index.c.get(cidx).profes = newprof;
}
publicstaticvoidshow(Stringa){
intcidx=0;
for(inti=0;i<Index.c.size();i++){
if(Index.c.get(i).name.equals(a)){
cidx=i;
break;
}
}
System.out.println("Course_Name:" + Index.c.get(cidx).name + " ");
System.out.println("Course_prof:" + Index.c.get(cidx).profes + " ");
System.out.println("Course_max:" + Index.c.get(cidx).max + " ");
System.out.println("Course_pre_deg:" + Index.c.get(cidx).d + " ");
System.out.println("Course_pre_year:" + Index.c.get(cidx).yr + " ");
System.out.println("Course_pre_othercourse:" + Index.c.get(cidx).other + " ");
if(Index.c.get(cidx).studenrolled.isEmpty()){
System.out.println("Course_students: No_Students_in_this_course");
}
else{
System.out.print("Course_students:");
for(inti=0;i<Index.c.get(cidx).studenrolled.size();i++){
System.out.print(Index.c.get(cidx).studenrolled.get(i) + " ");
}
System.out.println(); }
}
}