BookMyShow Low Level System design
- Manbodh ratre
- May 13, 2024
- 2 min read
Updated: Jul 20, 2024
import java.util.Date;
import java.util.List;
class User {
private int userID;
private String name;
private String email;
private String password;
private String phoneNumber;
public boolean login(String email, String password) {
// Implementation of login functionality
return false;
}
public boolean register(String name, String email, String password, String phoneNumber) {
// Implementation of user registration functionality
return false;
}
public boolean updateProfile(int userID, String name, String email, String password, String phoneNumber) {
// Implementation of profile update functionality
return false;
}
}
class Movie {
private int movieID;
private String title;
private String description;
private String genre;
private int duration;
private Date releaseDate;
private String language;
private double rating;
private List<String> cast;
private String director;
private String posterImage;
public List<Movie> searchMovies(String keyword) {
// Implementation of movie search functionality
return null;
}
}
class Theater {
private int theaterID;
private String name;
private String location;
private String address;
private String contactInfo;
private List<Screen> screens;
public List<Theater> searchTheaters(String location) {
// Implementation of theater search functionality
return null;
}
}
class Screen {
private int screenID;
private int capacity;
private Showtime currentShowtime;
public void setScreening(Showtime showtime) {
// Set screening for this screen
}
public void removeScreening() {
// Remove screening from this screen
}
}
class Show {
private int showID;
private Movie movie;
private Theater theater;
private Screen screen;
private Date dateTime;
private
private int availableSeats;
public boolean bookTickets(int userID, int showID, int numberOfSeats){
// Implementation of ticket booking functionality
return false;
}
public boolean cancelBooking(int userID, int showtimeID) {
// Implementation of booking cancellation functionality
return false;
}
}
class Booking {
private int bookingID;
private User user;
private Showtime showtime;
private int numberOfSeats;
private double totalPrice;
private Date bookingDateTime;
}
class Seat {
private int seatId;
private int showId;
private String seatNumber;
private boolean isBooked;
private double price;
private int version //. to handle concurrent booking request
public synchronized boolean bookSeat(){
// Implementation of ticket booking functionality
return isBooked = true;
}
public synchronized boolean cancelSeat() {
// Implementation of booking cancellation functionality
return isBooked = false;
}
}
Comments