-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBookOrder.java
61 lines (51 loc) · 921 Bytes
/
BookOrder.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
54
55
56
57
58
59
60
/**
*
* @author 154667
*
* This class stores a book order.
*
*/
public class BookOrder {
public String teacher;
public int room=0;
public int num=0;
public BookOrder(int r,int n,String t){
room=r;
num=n;
teacher=t;
}
private String toLength(String a, int l,char pad){
if(a.length()>=l){
return a.substring(0,l);
}
while(a.length()<l){
a+=""+pad;
}
return a;
}
public String getTeacher() {
return teacher;
}
public void setTeacher(String teacher) {
this.teacher = teacher;
}
public int getRoom() {
return room;
}
public void setRoom(int room) {
this.room = room;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public String toString(){
String result = " ";
result+=toLength(""+room,4,' ')+" | ";
result+=toLength(""+num,3,' ')+" | ";
result+=toLength(teacher,13,' ');
return result;
}
}