-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewRequest.java
42 lines (36 loc) · 1.06 KB
/
NewRequest.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
/*
CSE 17
Tyler Monaghan
tfm219
Program #5 DEADLINE: December 8, 2017
Program: WebRentz Movie Rental System
*/
import java.util.Date;
import java.text.SimpleDateFormat;
/** Represents a customer's request for a movie. subclass of Transaction */
public class NewRequest extends Transaction {
/** Constructor */
public NewRequest(Customer customer, Movie movie, Date date) {
super(customer, movie, date);
}
/** Returns message for a movie request */
public String getMovieEventString() {
SimpleDateFormat stdDate = new SimpleDateFormat("dd-MMM-yyyy");
return stdDate.format(date) + " Requested by " + customer.getName();
}
/** Returns true if they have the same customer movie and date for two request objects */
public boolean equals(Object o) {
if (o instanceof NewRequest) {
NewRequest other = (NewRequest) o;
if (customer.equals(other.customer) && movie.equals(other.movie) && date.equals(other.date)) {
return true;
}
else {
return false;
}
}
else {
return false;
}
}
}