forked from elenaxenouu/BookIt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppointmentSystem.java
More file actions
31 lines (27 loc) · 1.09 KB
/
AppointmentSystem.java
File metadata and controls
31 lines (27 loc) · 1.09 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
import java.util.ArrayList;
import java.util.List;
public class AppointmentSystem {
private final List<Service> services = new ArrayList<>();
// Προσθήκη υπηρεσίας από τον διαχειριστή
public void addService(Service service) {
services.add(service);
}
// Εμφάνιση όλων των υπηρεσιών
public void displayServices() {
System.out.println("Available Services:");
for (int i = 0; i < services.size(); i++) {
Service service = services.get(i);
System.out.println((i + 1) + ". " + service.getName() + " - "
+ service.getCost() + "€ - "
+ service.getDuration() + " hours");
}
}
// Λήψη υπηρεσίας βάσει επιλογής χρήστη
public Service getServiceByIndex(int index) {
if (index >= 0 && index < services.size()) {
return services.get(index);
} else {
return null; // Αν η επιλογή είναι εκτός ορίων
}
}
}