-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCourse.java
49 lines (42 loc) · 1.28 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
/**
* Created by ntuladhar on 1/15/18.
*/
public class Course {
private String name;
private String instructorName;
private String studentName;
private int totalHours;
//Constructor
public Course(String courseName,String instructorName, int totalHours)
{
this.name = name;
this.instructorName = instructorName;
this.totalHours = totalHours;
this.studentName=""
}
//Accessors
public String getName() {
return name;
}
public String getInstructorName() {
return instructorName;
}
public String getStudentName() {
return studentName;
}
public int getTotalHours() {
return totalHours;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
//Displays all the variables
public void Display() {
System.out.println(String.format("Course Name is %s ", getName()));
System.out.println(String.format("Instructor Name is %s ",getInstructorName()));
System.out.println(String.format("Total Hours requires to Complete the Course is %d ",getTotalHours());
if (!this.studentName.isEmpty()) {
System.out.println(String.format("Student Name is %s " ,getStudentName()));
}
}
}