Class Diagram for the Movie Ticket Booking System
Learn to create a class diagram for the movie ticket booking system using the bottom-up approach.
In this lesson, we are going to identify and design the classes, abstract classes, and interfaces based on the requirements that we have previously gathered from the interviewer in our movie ticket booking system.
Components of a movie ticket booking system
As mentioned earlier, we should design the movie ticket booking system using a bottom-up approach.
Seat
Our movie ticket booking system should have a Seat
object that will be an abstract class and can be of three types: silver, gold, and platinum. Each seat type will have a fixed cost and differs from one another.
The visual representation of these classes is as follows:
Show time
The ShowTime
class represents a particular show of a movie and contains information like the start time, the date on which the show is airing, and the number of seats available for the show.
Here is what the class definition looks like:
Hall
The Hall
class is responsible for finding the current show airing. It contains the ID attribute as there can be multiple halls inside a cinema and is composed of a ShowTime
object that specifies the currently airing show.
The UML representation of the class is shown below:
Cinema
The Cinema
class consists of the number of halls present in the cinema along with the city in which it is located and an id attribute to identify the cinema in that particular city.
The class representation of the Cinema
class is as follows:
City
The City
class includes the name of the city, the state it is located in, and its zip code. In addition, it includes a list of all the cinemas available in the city.
The UML representation of the class is shown below:
Movie
The Movie
class contains all the various details of a particular movie, such as the title, genre, language, and release date. It is also composed of a list of running shows.
Here is what the class definition looks like:
Movie ticket
The MovieTicket
class refers to a customer’s ticket for a particular movie with a ticketID
as its unique identifier. It describes the details of the seat in the hall and the movie for which the ticket was bought, along with the show details.
The class representation of the ...
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.