-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUser.java
More file actions
31 lines (22 loc) · 711 Bytes
/
User.java
File metadata and controls
31 lines (22 loc) · 711 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
package officialInternalAssessment;
import java.io.*;
import java.util.*;
public abstract class User {
private String username;
private String password;
private String role;
public User(String username, String password, String role) {
this.username = username;
this.password = password;
this.role = role.toLowerCase();
}
public String getUsername() { return username; }
public String getPassword() { return password; }
public String getRole() { return role; }
// Polymorphic method (overridden in subclasses)
public abstract boolean isStudent();
@Override
public String toString() {
return role + ": " + username;
}
}