-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdmin.java
47 lines (34 loc) · 995 Bytes
/
Admin.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
import java.util.Scanner;
public class Admin extends User {
private String passWord;
private int level;
public Admin(String id, String name, String passWord, int level) {
super(id, name);
this.passWord = passWord;
this.level = level;
}
public int getLevel() {
return level;
}
public String getPassword() {
return passWord;
}
public boolean login() {
Scanner sc = new Scanner(System.in);
System.out.print("Please input password for Admin " + getId() + " " + getName() + ":");
String pass = sc.nextLine();
// compare input with password
if (pass.equals(getPassword())) {
System.out.println("Admin " + getId() + " " + getName() + " Login successful.");
return true;
}
else {
System.out.print("Admin " + getId() + " " + getName() + " Login fail.");
return false;
}
}
public boolean download(Content content) {
System.out.println("Admin cannot download content.");
return false;
}
}