-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminService.java
More file actions
33 lines (27 loc) · 981 Bytes
/
AdminService.java
File metadata and controls
33 lines (27 loc) · 981 Bytes
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
package services;
import models.*;
import java.util.*;
import APP.Main;
public class AdminService {
static List<Movie> movies = Main.movies;
static List<Booking> bookings = Main.bookings;
static int movieIdCounter = 1;
public static void addMovie(String title, String genre, int duration, double rating) {
movies.add(new Movie(movieIdCounter++, title, genre, duration, rating));
System.out.println("Movie added successfully!");
}
public static void viewMovies() {
for (Movie m : movies) {
System.out.println(m.id + " - " + m.title + " (" + m.genre + ")");
}
}
public static void deleteMovie(int id) {
movies.removeIf(m -> m.id == id);
System.out.println("Movie deleted!");
}
public static void viewBookings() {
for (Booking b : bookings) {
System.out.println("Booking ID: " + b.id + " User: " + b.userId);
}
}
}