Assignment 1
Worth: 10%
DUE: March 4th, 2022 at 11:55pm; submitted on MOODLE.
Warning
For this assignment, you may not work with anyone else.
You need to work independently.
How to submit your work
You need to submit your C++ (.h/.cpp) files directly on moodle. The first two lines of the C++ file should be as follows:
// Student name:
// Student number:
Instructions
In this first assignment you implement a simple database of movies.
The database will allow the user to enter a movie name.
Your program should print the IMDB rating for the movie.
The program stop when the enter “quit”.
Dataset
The dataset is extracted from the official dataset of IMDB.
It is composed of two files:
titles.csv
: A CSV file with the id of the movie and its title.ratings.csv
: A CSV file with the id of the movie and its rating.
You need to download the files.
Important
Not all movie has a rating. You will need to handle this case.
Structure of your program
The program should contain the following files:
main.cpp
MovieDB.h/.cpp : It’s the main class of the program, it contains the two sub-databases
TitleDB.h/.cpp : The database that will contain only the id and the title of the movie.
RatingDB.h/.cpp : The database that will contain only the id and the rating of the movie.
main.cpp
This file should take two arguments from the console:
IMDB <titleDB_file_name> <ratingDB_file_name>
IMDB
is the name of the executable.
Then it should create the class
MovieDB
.Then it ask the user to enter a movie name.
If the movie exist it returns the rating and ask a new movie.
Otherwise, it print a message saying that this movie doesn’t exist and ask a new movie.
Finally, the program ends when the user type “quit”.
MovieDB
The principal class of your program.
The constructor should take the three files in argument.
With the DB files it should create the two classes
TitleDB
andRatingDB
.It should have a method taking the movie name entered by the user and make the correct request to obtain the rating of the movie.
TitleDB
This class must be Splay Tree.
The sorting must be on the movie title.
It must contain a find methods that will return the id of the movie.
The node contains the movie title and the id.
It should contain the methods of a Splay tree.
RatingDB
This class must be Splay Tree.
The sorting must be on the movie ID.
It must contain a find methods that will return the rating of the movie.
The node contains the movie title and the id.
It should contain the methods of a Splay tree.
Some marking details
Warning
Having the correct outputs doesn’t mean that you will obtain a perfect mark.
The marking will depend on:
Correctness.
Comments
Variable names
Style
etc.
General FAQ:
- Does my text file have enough details?
Probably. The shorter the better.
- Do I have enough comments?
I don’t know, maybe? If you’re looking at code and have to ask if you should comment it… just comment it. That said, don’t write me a book.
- Can I work with my friend?
No.
- If our code/functions are identical, you won’t really call this cheating, would you?
Yes.
- Moodle was totally broken, it’s not my fault it’s late.
Nice try.
- I accidentally submitted the wrong code. Here is the right code, but it’s late. But you can see that I submitted the wrong code on time! You’ll still accept it, right?
No.