arslanasghar6637 commited on
Commit
ddef4e2
·
verified ·
1 Parent(s): 11d5f25

Create Main.py

Browse files
Files changed (1) hide show
  1. Main.py +41 -0
Main.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def main():
2
+ while True:
3
+ print("\nDoctor Appointment App")
4
+ print("1. Book Appointment")
5
+ print("2. View Appointments")
6
+ print("3. Cancel Appointment")
7
+ print("4. Exit")
8
+ choice = input("Enter your choice: ")
9
+
10
+ if choice == '1':
11
+ patient_name = input("Enter patient name: ")
12
+ doctor_name = input("Enter doctor name: ")
13
+ date = input("Enter date (YYYY-MM-DD): ")
14
+ time = input("Enter time (HH:MM): ")
15
+ appointment = Appointment(patient_name, doctor_name, date, time)
16
+ appointment.save()
17
+ print("Appointment booked successfully!")
18
+
19
+ elif choice == '2':
20
+ appointments = Appointment.get_all()
21
+ if appointments:
22
+ print("\nAppointments:")
23
+ for appt in appointments:
24
+ print(f"ID: {appt[0]}, Patient: {appt[1]}, Doctor: {appt[2]}, Date: {appt[3]}, Time: {appt[4]}")
25
+ else:
26
+ print("No appointments found.")
27
+
28
+ elif choice == '3':
29
+ appointment_id = input("Enter appointment ID to cancel: ")
30
+ Appointment.cancel(appointment_id)
31
+ print("Appointment canceled successfully!")
32
+
33
+ elif choice == '4':
34
+ print("Exiting...")
35
+ break
36
+
37
+ else:
38
+ print("Invalid choice. Please try again.")
39
+
40
+ if __name__ == "__main__":
41
+ main()