Programming Assignment 5 (Movies Database)
In this programming assignment, you will develop a Python program to keep track of data about movies, theaters, and shows. We will use an object-oriented design of the data.
We will use four Python Classes:
- Movie.py: encapsulates information about a single Movie.
The constructor method is shown below:
def __init__(self,id,t,c,y): self.mid = id self.title = t self.country = c self.year = y self.shows = [] # list of Show objects for this movie
- Theater.py: encapsulates information about a single theater.
The constructor method is shown below:
def __init__(self,id,n,c): self.tid = id self.tname = n self.city = c self.screens = [] # list of screens for this theater
- Screen.py: encapsulates information about a single screen within a theater
The constructor method is shown below:
def __init__(self,id,n,t): self.sid = id self.sname = n self.theater = t # theater in which this screen is present self.shows = []
- Show.py: encapsulates information about a single Show.
The constructor method is shown below:
def __init__(self,dt,n): self.sdatetime = dt self.nvisitors = n self.movie = None self.screen = None
The program takes the name of a folder as command line argument. Within the folder you should place the individual files containing data for each class. I am providing two datasets: a small one and a bigger one.
small-data (in zip format: small-data.zip)
data (in zip format: data.zip)
The following are skeleton files (also available as zip: skeleton-files.zip) for you to use in the assignment:
Movie.py
Theater.py
Screen.py
Show.py
MovieDB.py
Sample run of the program is shown below:
ASCSC1PP629W1:solution raj$ python3 MovieDB.py small-data Menu Options Theater Cities (c) Movie IDs (d) Theater IDs (h) Movies Screened in Theater (t tid) Movie Statistics (m mid) Show Listings for Movie in City (s mid city) Quit (q) Enter your option: c Cities: Atlanta, Doraville Menu Options Theater Cities (c) Movie IDs (d) Theater IDs (h) Movies Screened in Theater (t tid) Movie Statistics (m mid) Show Listings for Movie in City (s mid city) Quit (q) Enter your option: d mids: m1, m2, m3 Menu Options Theater Cities (c) Movie IDs (d) Theater IDs (h) Movies Screened in Theater (t tid) Movie Statistics (m mid) Show Listings for Movie in City (s mid city) Quit (q) Enter your option: h tids: t1, t2 Menu Options Theater Cities (c) Movie IDs (d) Theater IDs (h) Movies Screened in Theater (t tid) Movie Statistics (m mid) Show Listings for Movie in City (s mid city) Quit (q) Enter your option: t t2 Movies screened in Multiplex I Star Wars Menu Options Theater Cities (c) Movie IDs (d) Theater IDs (h) Movies Screened in Theater (t tid) Movie Statistics (m mid) Show Listings for Movie in City (s mid city) Quit (q) Enter your option: t t1 Movies screened in Odeon Gandhi Star Wars Menu Options Theater Cities (c) Movie IDs (d) Theater IDs (h) Movies Screened in Theater (t tid) Movie Statistics (m mid) Show Listings for Movie in City (s mid city) Quit (q) Enter your option: m m1 Statistics for Star Wars Matinee Visitors: 20 @$5 each = $ 100 Evening Visitors: 70 @$8 each = $ 560 TOTAL Revenue: $660 Menu Options Theater Cities (c) Movie IDs (d) Theater IDs (h) Movies Screened in Theater (t tid) Movie Statistics (m mid) Show Listings for Movie in City (s mid city) Quit (q) Enter your option: m m3 Statistics for Ran Matinee Visitors: 0 @$5 each = $ 0 Evening Visitors: 0 @$8 each = $ 0 TOTAL Revenue: $0 Menu Options Theater Cities (c) Movie IDs (d) Theater IDs (h) Movies Screened in Theater (t tid) Movie Statistics (m mid) Show Listings for Movie in City (s mid city) Quit (q) Enter your option: s m1 Atlanta Screenings for Star Wars in Atlanta ------------------------------------------------------ Theater Screen Date Time #Visitors ------------------------------------------------------ Odeon North I 11/16/2011 12 PM 20 Odeon North II 11/16/2011 06 PM 30 ------------------------------------------------------ Menu Options Theater Cities (c) Movie IDs (d) Theater IDs (h) Movies Screened in Theater (t tid) Movie Statistics (m mid) Show Listings for Movie in City (s mid city) Quit (q) Enter your option: q ASCSC1PP629W1:solution raj$TO SUBMIT: Movie.py, Theater.py, Screen.py, Show.py, and MovieDB.py.