-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppointmentApp.java
More file actions
68 lines (64 loc) · 3.04 KB
/
Copy pathAppointmentApp.java
File metadata and controls
68 lines (64 loc) · 3.04 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
import java.util.Scanner;
public class AppointmentApp {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Appointment appointment = null;
int user_choice;
do {
System.out.println("Welcome to the Tutoring/Office-hours Appointment Portal. Kindly select a number from the menu below.");
System.out.println("1) Make an appointment");
System.out.println("2) View Appointment");
System.out.println("3) Change Appointment");
System.out.println("4) Exit");
System.out.println("Enter your choice: ");
user_choice = scanner.nextInt();
scanner.nextLine();
switch (user_choice) {
case 1:
System.out.println("Enter student name: ");
String name = scanner.nextLine();
System.out.println("Enter the venue: ");
String venue = scanner.nextLine();
System.out.println("Enter the purpose: ");
String purpose = scanner.nextLine();
appointment = new Appointment(name, venue, purpose);
System.out.println("Your appointment has been made successfully!");
break;
case 2:
if (appointment != null) {
System.out.println("Here are your appointment details: ");
appointment.displayDetails();
} else {
System.out.println("You have no appointments yet.");
}
break;
case 3:
if (appointment != null) {
System.out.println("Enter new student name: ");
String newName = scanner.nextLine();
System.out.println("Enter the new venue: ");
String newVenue = scanner.nextLine();
System.out.println("Enter the new purpose: ");
String newPurpose = scanner.nextLine();
appointment.setStudentName(newName);
appointment.setVenue(newVenue);
appointment.setPurpose(newPurpose);
System.out.println("The appointment details have been updated successfully!");
} else {
System.out.println("You have no appointments yet. Please create one.");
}
break;
case 4:
System.out.println("Exiting Portal");
System.out.println(".");
System.out.println("..");
System.out.println("...");
System.out.println("Thank you for using this service!");
break;
default:
System.out.println("Invalid Option. Kindly try again.");
}
} while (user_choice != 4);
scanner.close();
}
}