-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourse.java
More file actions
81 lines (65 loc) · 2.01 KB
/
Course.java
File metadata and controls
81 lines (65 loc) · 2.01 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
69
70
71
72
73
74
75
76
77
78
79
80
81
public class Course {
private String courseCode;
private String weeklyTimeSlots ;
private String finalExamDate;
private String[] traineeNames ;
private double tuition ;
public int numTrainees ;
public static int totalCourses ;
public Course(){
courseCode = "";
weeklyTimeSlots ="";
finalExamDate="";
tuition = 0;
traineeNames = new String [3];
}
public Course (String theCourseCode ,String CTimeSlots, String CFinalExamDate , double CTuition){
courseCode = theCourseCode;
weeklyTimeSlots = CTimeSlots;
finalExamDate = CFinalExamDate;
tuition = CTuition;
traineeNames = new String [3];
}
public void setCourseCode(String courseCode){
this.courseCode= courseCode;
}
public void setWeeklyTimeSlots (String weeklyTimeSlots) {
this.weeklyTimeSlots=weeklyTimeSlots;
}
public void setFinalExamDate (String finalExamDate) {
this.finalExamDate=finalExamDate;
}
public void setTuition (double tuition) {
this.tuition=tuition;
}
public void setTraineeNames (String[] traineeNames) {
numTrainees = 0 ;
for (int i = 0 ; i < 3 ; i++){
this.traineeNames[i] = traineeNames[i] ;
numTrainees++; }
}
public String getCourseCode(){
return courseCode;
}
public double getTuition(){
return tuition;
}
public String getWeeklyTimeSlots() {
return weeklyTimeSlots;
}
public String getFinalExamDate() {
return finalExamDate;
}
public String[] getTraineeNames() {
return traineeNames ;
}
public void DisplayCourseInfo() {
System.out.println("***** Course Information *****");
System.out.println("Course Code: "+ courseCode);
System.out.println("Course Availability: " + (numTrainees >= 3 ? "Not available" : "Available"));
System.out.println("Tuition: "+ tuition);
System.out.println("Weekly Time Slots: \n Day "+ weeklyTimeSlots.substring(0,3) +" Time "+ weeklyTimeSlots.substring(4));
System.out.println("Final Exam Date: \n Day: "+ finalExamDate.substring(0,2) +" Month: "+finalExamDate.substring(3,5) +
" Year: " + finalExamDate.substring(6));
}
}