-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTeacher.java
More file actions
39 lines (33 loc) · 1006 Bytes
/
Teacher.java
File metadata and controls
39 lines (33 loc) · 1006 Bytes
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
public class Teacher {
private String teacherID;
private String firstName;
private String lastName;
private String email;
// Constructor to initialize the attributes
public Teacher(String teacherID, String firstName, String lastName, String email) {
this.teacherID = teacherID;
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
}
// Getter methods for accessing the attributes
public String getTeacherID() {
return teacherID;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getEmail() {
return email;
}
// Override toString method to provide a formatted string representation
@Override
public String toString() {
return "Teacher ID: " + teacherID + "\n" +
"Name: " + firstName + " " + lastName + "\n" +
"Email: " + email;
}
}