-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUser.java
53 lines (51 loc) · 1.41 KB
/
User.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
50
51
52
53
public class User {
private String UserType;
private String UserName;
private int BorrowNum;
public void set(String raw){
String sp[] = raw.split(" ");
if(sp.length==2){
this.UserType = "Staff";
this.UserName = sp[1];
}
else{
this.UserType = "Borrower";
this.UserName = sp[1];
this.BorrowNum = Integer.parseInt(sp[2]);
}
}
public void print(){
System.out.printf("UserType "+UserType
+" UserName "+UserName
+" BorrowNum "+BorrowNum+"\n");
}
public void setUserType(String UserType){
if(UserType.isBlank()){
System.out.println("usertype not be blank!");
}
else if(UserType.equalsIgnoreCase("Staff")
||UserType.equalsIgnoreCase("Borrower")){
this.UserType = UserType;
}
}
public void setUserName(String UserName){
if(UserName.isBlank()){
System.out.println("UserName not be blank!");
}
else{
this.UserName = UserName;
}
}
public void setBorrowNum(int BorrowNum){
this.BorrowNum = BorrowNum;
}
public String getUserType(){
return this.UserType;
}
public String getUserName(){
return this.UserName;
}
public int getBorrowNum(){
return this.BorrowNum;
}
}