-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReservation.java
More file actions
62 lines (60 loc) · 1.71 KB
/
Copy pathReservation.java
File metadata and controls
62 lines (60 loc) · 1.71 KB
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
61
62
/**
* A Class for Reservations for Flights, Rooms, and Car Rentals
* @author rcd1
*/
public class Reservation {
private Date startDate;
private Date endDate;
private Time startTime;
private Time endTime;
/**
* Sets local variables to passed in parameters
* @param start date for the date
* @param end date for the date
* @param start time for the time
* @param end time for the time
*/
public Reservation(Date startDate, Date endDate, Time startTime, Time endTime) {
this.startDate = startDate;
this.endDate = endDate;
this.startTime = startTime;
this.endTime = endTime;
}
public Reservation(String startDate, String endDate, String startTime, String endTime) {
this.startDate = new Date(startDate);
this.endDate = new Date(endDate);
this.startTime = new Time(startTime);
this.endTime = new Time(endTime);
}
//Getters
public Date getStartDate() {
return startDate;
}
public Date getEndDate() {
return endDate;
}
public Time getStartTime() {
return startTime;
}
public Time getEndTime() {
return endTime;
}
//Setters
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public void setStartTime(Time startTime) {
this.startTime = startTime;
}
public void setEndTime(Time endTime) {
this.endTime = endTime;
}
//Other Methods
public String toString() {
return startDate.toString() + ": " + startTime.toString() +
"\n" + endDate.toString() + ": " + endTime.toString();
}
}