-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathValidTicket.java
More file actions
48 lines (41 loc) · 996 Bytes
/
ValidTicket.java
File metadata and controls
48 lines (41 loc) · 996 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
40
41
42
43
44
45
46
47
48
package nullobject;
/**
* @author 1851594王思桐
*/
public class ValidTicket implements Ticket{
private String ID;
private String customerID;
private String year;
public ValidTicket(String ID, String customerID, String year){
this.ID = ID;
this.customerID = customerID;
this.year = year;
}
public ValidTicket(){
this("0001","0001","adult");
}
@Override
public String getID() {
return ID;
}
@Override
public String getCustomerID() {
return customerID;
}
/**
* show Info of the Ticket
* @return info:String,stitched together from instance information and ID
*/
@Override
public String getInfo() {
return "ValidTicket:("+this.hashCode() + "):getInfo():" + ID;
}
@Override
public void buy() {
System.out.println("buy: The visitor " + ID +" is a "+year);
}
@Override
public boolean isNull() {
return false;
}
}