-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBookingUpForBeauty.java
More file actions
30 lines (23 loc) · 1.02 KB
/
Copy pathBookingUpForBeauty.java
File metadata and controls
30 lines (23 loc) · 1.02 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
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
class AppointmentScheduler {
public LocalDateTime schedule(String appointmentDateDescription) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss");
return LocalDateTime.parse(appointmentDateDescription, formatter);
}
public boolean hasPassed(LocalDateTime appointmentDate) {
return LocalDateTime.now().isAfter(appointmentDate);
}
public boolean isAfternoonAppointment(LocalDateTime appointmentDate) {
int hour = appointmentDate.getHour();
return hour >= 12 && hour < 18;
}
public String getDescription(LocalDateTime appointmentDate) {
DateTimeFormatter formatterDesc = DateTimeFormatter.ofPattern("EEEE, MMMM d, YYYY, 'at' h:mm a.");
return "You have an appointment on " + formatterDesc.format(appointmentDate);
}
public LocalDate getAnniversaryDate() {
return LocalDate.of(2024,9,15);
}
}