-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeacher.java
More file actions
66 lines (62 loc) · 1.82 KB
/
Copy pathTeacher.java
File metadata and controls
66 lines (62 loc) · 1.82 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
/**
* Write a description of class Teacher here.
*
* @author (Sabin Karki)
* @version (a version number or a date)
*/
public class Teacher
{
//Attributes
private int teacherId;
private String teacherName;
private String address;
private String workingType;
private String employmentStatus;
private int workingHours;
//Constructor
public Teacher(int teacherId, String teacherName, String address, String workingType, String employmentStatus)
{
this.teacherId = teacherId;
this.teacherName = teacherName;
this.address= address;
this.workingType= workingType;
this.employmentStatus= employmentStatus;
}
//Accessor Method
public int getTeacherId(){
return this.teacherId;
}
public String getTeacherName(){
return this.teacherName;
}
public String getAddress(){
return this.address;
}
public String getWorkingType(){
return this.workingType;
}
public String getEmploymentStatus(){
return this.employmentStatus;
}
public int getWorkingHours(){
return this.workingHours;
}
//Setter Method
public void setWorkingHours(int workingHours){
this.workingHours= workingHours;
}
//Display method
public void display(){
System.out.println("Teacher ID: "+this.getTeacherId());
System.out.println("Teacher Name: "+this.getTeacherName());
System.out.println("Teacher Address: "+this.getAddress());
System.out.println("Teacher Working Type: "+this.getWorkingType());
System.out.println("Teacher Employment Status: "+this.getEmploymentStatus());
//Applying condition
if(getWorkingHours()>0){
System.out.println("Teacher Working Hours: "+this.getWorkingHours());
}else{
System.out.println("Teacher Working Hours: null");
}
}
}