-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathLanClinicApp.java
More file actions
104 lines (79 loc) · 3.28 KB
/
LanClinicApp.java
File metadata and controls
104 lines (79 loc) · 3.28 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
package org.codedifferently;
import java.util.Scanner;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class LanClinicApp {
public static void main(String[] args) {
LanClinicSystem clinic = new LanClinicSystem();
Scanner sc = new Scanner(System.in);
DateTimeFormatter formatter =
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
boolean running = true;
while (running) {
System.out.println("\n=== CLINIC MENU ===");
System.out.println("1 Add Patient");
System.out.println("2 View Patients");
System.out.println("3 Check In Patient");
System.out.println("4 Search Patient");
System.out.println("5 Schedule Appointment");
System.out.println("6 Cancel Appointment");
System.out.println("7 View Schedule");
System.out.println("8 Daily Report");
System.out.println("9 Complete Appointment");
System.out.println("10 Exit");
System.out.println("Please Select a choice: ");
String choice = sc.nextLine();
switch(choice) {
case "1":
System.out.print("Name: ");
clinic.addPatient(sc.nextLine());
break;
case "2":
clinic.viewAllPatients();
break;
case "3":
System.out.print("ID or Name: ");
clinic.checkInPatient(sc.nextLine());
break;
case "4":
System.out.println("================================");
System.out.print("ID or Name: ");
System.out.println(clinic.searchPatient(sc.nextLine()));
break;
case "5":
System.out.println("================================");
System.out.print("Patient ID: ");
clinic.scheduleAppointment(sc.nextLine());
break;
case "6":
System.out.println("=================================");
System.out.print("Patient ID: ");
clinic.cancelAppointment(sc.nextLine());
break;
case "7":
clinic.viewSchedule();
break;
case "8":
clinic.dailySummary();
break;
case "9":
try {
System.out.println("=============================");
System.out.print("Patient ID: ");
String id = sc.nextLine();
System.out.print("DateTime yyyy-MM-dd HH:mm: ");
LocalDateTime time =
LocalDateTime.parse(sc.nextLine(), formatter);
clinic.completeAppointment(id, time);
} catch(Exception e) {
System.out.println("Invalid format.");
}
break;
case "10":
running = false;
break;
}
}
sc.close();
}
}