-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBooking.java
More file actions
162 lines (161 loc) · 4.49 KB
/
Copy pathBooking.java
File metadata and controls
162 lines (161 loc) · 4.49 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import java.util.*;
import java.text.*;
import java.time.*;
import java.time.format.*;
/**
*Public Class for Bookings
*
*/
public class Booking
{
public int bookingId;
public int facilityId;
public int userId;
public LocalDate bookingDate;
public int bookingSlot;
public boolean paymentStatus;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
/**
*Construcutor method to create Booking object
*
*@param bookingId Input is the Id of the booking
*@param facilityId Input is the Id of the facility for which the booking is made for
*@param userId Input is the Id of the user who made the booking
*@param bookingDate Inputs is the date of when the booking is made for in the LocalDate type.
*@param bookingSlot Input is the position of the day/time the booking is made for
*@param paymentStatus Inputs the boolean of whether the user has paid for this booking or not
*
*/
public Booking(int bookingId, int facilityId, int userId, LocalDate bookingDate, int bookingSlot, boolean paymentStatus)
{
this.bookingId = bookingId;
this.facilityId = facilityId;
this.userId = userId;
this.bookingDate = bookingDate;
this.bookingSlot = bookingSlot;
this.paymentStatus = paymentStatus;
}
/**
*Construcutor method to create Booking object
*
*@param bookingId is the Id of the booking
*@param facilityId is the Id of the facility for which the booking is made for
*@param userId is the Id of the user who made the booking
*@param bookingDate is the date of when the booking is made for
*@param bookingSlot is the position of the day/time the booking is made for
*@param paymentStatus is the boolean of whether the user has paid for this booking or not
*
*/
public Booking(int bookingId, int facilityId, int userId, String bookingDate, int bookingSlot, boolean paymentStatus)
{
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
this.bookingId = bookingId;
this.facilityId = facilityId;
this.userId = userId;
this.bookingDate = LocalDate.parse(bookingDate, formatter);
this.bookingSlot = bookingSlot;
this.paymentStatus = paymentStatus;
}
/**
*Get method for BookingId of the booking made
*
*@return Returns the booking id of a booking object.
*
*/
public int getBookingId()
{
return bookingId;
}
/**
*Get method for FacilityId of the booking
*
*@return facilityId Returns a int of the facilities id number.
*
*/
public int getFacilityId()
{
return facilityId;
}
/**
*Get method for UserId of the booking made
*
*@return userID Returns a int of the UserId that is made for the booking
*
*/
public int getUserId()
{
return userId;
}
/**
*Get method for the booking date of the booking made
*
*@return bookingDate Returns a LocalDate of the day the booking is made for.
*
*/
public LocalDate getBookingDate()
{
return bookingDate;
}
/**
*Get method for the slot for which the booking is made
*
*@return bookingSlot The booking is made for on that date
*
*/
public int getBookingSlot()
{
return bookingSlot;
}
/**
*Get method for whether the user has paid for their booking or not
*
*@return paymentStatus Boolean return based on payment status.
*
*/
public boolean getPaymentStatus()
{
return paymentStatus;
}
/**
*Mehtod to convert all Booking info made to one String
*
*@return info Contains all booking variables seperated by a ","
*
*/
public String bookingToString()
{
String temp = bookingDate.format(formatter);
String info = bookingId + "," + facilityId + "," + userId + "," + temp + "," + bookingSlot + "," + paymentStatus;
return info;
}
/**
*Set Method to give a booking a date, alternative to the LocalDate
*
*@param aDate Date entered as a String is the date the user wishes to book for
*
*/
public void setBookingDate(String aDate)
{
this.bookingDate = LocalDate.parse(aDate);
}
/**
*Set Method to give a booking a date
*
*@param aDate date the user wishes to book for
*
*/
public void setBookingDate(LocalDate aDate)
{
this.bookingDate = aDate;
}
/**
*Set Method to give a booking a payment status
*
*@param paymentStatus Boolean of whether the user has paid for the booking or not
*
*/
public void setPaymentStatus(boolean paymentStatus)
{
this.paymentStatus=paymentStatus;
}
}