In this homework, you will apply many of the concepts covered so far during the semester, including control structures (sequence, selection and repetition), functions, pointers, dynamic memory management, and linear data structures. In addition, you will apply the techniques of operator overloading and copy constructors to design classes that are easier to use. After completion, you should feel comfortable with allocating memory on the heap to create more complex data structures, overloading binary and unary operators, and properly implementing copy constructors to achieve deep copy of objects at runtime. Specifically, you will learn how to link different objects in the heap together, to (bi-directionally) traverse through these objects in memory, and to de-allocate all memory previously allocated in the heap.
Objectives:
In this homework, you will build upon the basic version of the Netflix Movie Queue. The Queueit is really not a queue but the preferred term in Netflix lingowill be implemented as a bi-directional dynamic linked-list (in the Heap). That is, each node in the list must contain "links" or pointers to the nodes immediately adjacent to it in the list data structure (e.g., pPreviousNode and pNextNode). Each node now represents a profile that supports multiple users in managing their movie preferences. For example, within one account (e.g., a household account), there could be multiple profiles for parents, and individual kids. Each profile can support multiple movie categories, e.g., Horror, Family, Suspense, etc. Each category has a list of movies associated with the category. The conceptual view of the new and improved Netflix Queue is presented in Figure 1.
Figure 1. Conceptual View of the Improved Netflix Queue Data Structure see image.
Your Netflix software shall meet the following requirements while fully supporting profiles and categories:
1. The software shall provide a main menu with options to accomplish the following:
a. Displaying Movies in the Queue
b. Adding Movies to the Queue
c. Editing Movies in Queue
d. Removing Movie from Queue
e. Searching for Movie in Queue
2. The main menu shall execute until the user quits the program.
3. Upon exiting the program, the software shall de-allocate or destroy all memory used by the Queue. This shall be done via destructor functions.
4. The software shall keep track of the following movie information.
a) Movie name
b) Rating
c) Ranking
d) Year
e) Category {Horror, Family, Suspense, Comedy, etc.}
5. The software ranking shall be accepted as a numeric input, from 1-5; 1 for lowest and 5 for highest.
6. The software ranking shall be displayed as output as a series of asterisk characters'*' reflecting the ranking number entered by the user.
7. The software shall detect duplicate movies by name and year. To compare movies, you must overload the '==' and `!=' operators.
8. The software shall allow the option to display the contents of the queue by highest to lowest ranking.
9. The software shall allow the option to display the contents of the queue by lowest to highest ranking.
10. The software shall allow the option to filter the display of movies in the queue by Rating or Category.
11. The software shall display the list of movies for a given Category by overloading the '<< operator.
12. The software shall allow users to create a new profile by copying movies from an existing profile. This must be done via the copy constructor.
13. The software shall keep track of the number of movies in each category for each profile. The number of movies per category shall be incremented/decremented by overloading the '++' and `--operators, respectively.
14. The software shall sort movies in alphabetical order using insertion sort.
15. The software shall verify all inputs to prevent it from crashing.
16. The software shall match the sample execution below.
Welcome to the Netflix Movie Menu! Please select (or create a profile:
1. Add New Profile
2. Exit Program
Enter option: 1
Enter Profile Label: Dad's Profile
Enter First Name: John
Enter Last Name: Doe
Enter Age: 45
Profile Created!
Welcome to the Netflix Movie Menu! Please select (or create) a profile:
1. Dad's Profile
2. Add New Profile
3. Exit Program
Enter Option: 2
Enter Profile Label: Sarah Enter
First Name: Sarah
Enter Last Name: Doe
Enter Age: 15
Enter Number of Profile to Copy or 0 to create new profile: 0
Profile Created!
Welcome to the Netflix Movie Menu! Please select (or create) a profile:
1. Dad's Profile
2. Sarah
3. Add New Profile
4. Exit Program
Enter Option: 1
Dad's Profile Movie Queue
1. Display Movie Queue
2. Add Movie to Queue
3. Edit Movie in Queue
4. Remove Movie from Queue
5. Search for Movie in Queue
6. Exit Profile
Enter option: 1
The movie queue is empty! Please add movies to the queue.
1. Display Movie Queue
2. Add Movie to Queue
3. Edit Movie in Queue
4. Remove Movie from Queue
5. Search for Movie in Queue
6. Exit Profile
Enter option: 2
Enter Movie Name: The Wizard of Oz
Enter Year: 1939
Category: Family
Rating: PG
Ranking (1-5): 4
Movie added to the Queue!
1. Display Movie Queue
2. Add Movie to Queue
3. Edit Movie in Queue
4. Remove Movie from Queue
5. Search for Movie in Queue
6. Exit Profile
Enter option: 2
Enter Movie Name: Vampires
Enter Year: 1986
Category: Horror
Rating: R
Ranking (1-5): 5
Movie added to the Queue!
1. Display Movie Queue
2. Add Movie to queue
3. Edit Movie in Queue
4. Remove Movie from Queue
5. Search for Movie in Queue
6. Exit Profile
Enter option: 2
Enter Movie Name: The Croods
Enter Year: 2013
Category: F
amily Rating: PG
Ranking (1-5): 3
Movie added to the Queue!
1. Display Movie Queue
2. Add Movie to Queue
3. Edit Movie in Queue
4. Remove Movie from Queue
5. Search for Movie in Queue
6. Exit Profile
Enter option: 1
Display options:
1. Highest to Lowest Ranking
2. Lowest to Highest Ranking
3. Filter by Rating
4. Filter by Category
5. Sorted movie queue
6. Exit Display Menu
Enter option: 3
Enter Rating: PG
The movies in your Queue with Rating PG are displayed below.
----------------------------
The Wizard of Oz
Year: 1939
Category: Family
Rated: PG
Ranked: ****
----------------------------
The Croods
Year: 2013
Category: Family
Rated: PG Ranked: ***
----------------------------
Display options:
1. Highest to Lowest Ranking
2. Lowest to Highest Ranking
3. Filter by Rating
4. Filter by Category
5. Sorted movie queue
6. Exit Display Menu
Enter option: 1
The movies in your Queue are displayed below.
----------------------------
Vampires
Year: 1986
Category: Horror
Rated: R
Ranked: *****
----------------------------
The Wizard of Oz
Year: 1939
Rated: PG
Ranked: ****
----------------------------
The Croods
Year: 2013
Category: Family
Rated: PG
Ranked: ***
----------------------------
Display options:
1. Highest to Lowest Ranking
2. Lowest to Highest Ranking
3. Filter by Rating
4. Filter by Category
5. Sorted movie queue
6. Exit Display Menu
Enter option: 4
Enter Category: Family
The movies in your Queue for category Family are displayed below.
----------------------------
The Wizard of Oz
Year: 1939
Category: Family
Rated: PG
Ranked: ****
----------------------------
The Croods
Year: 2013
Category: Family
Rated: PG
Ranked: ***
----------------------------
Display options:
1. Highest to Lowest Ranking
2. Lowest to Highest Ranking
3. Filter by Rating
4. Filter by Category
5. Sorted movie queue
6. Exit Display Menu
Enter option: 6
Exiting Display Menu.
1. Display Movie Queue
2. Add Movie to Queue
3. Edit Movie in Queue
4. Remove Movie from Queue
5. Search for Movie in Queue
6. Exit Profile
Enter option: 4
Enter Movie Name: The Croods
Enter Year: 2013
The Croods has been removed from your queue!
1. Display Movie Queue
2. Add Movie to Queue
3. Edit Movie in Queue
4. Remove Movie from Queue
5. Search for Movie in Queue
6. Exit Profile
Enter option: 1
Display options:
1. Highest to Lowest Ranking
2. Lowest to Highest Ranking
3. Filter by Rating
4. Filter by Category
5. Sorted movie queue
6. Exit Display Menu
Enter option: 1
The movies in your Queue are displayed below.
----------------------------
Vampires
Year: 1986
Category: Horror
Rated: R
Ranked: *****
----------------------------
The Wizard of Oz
Year: 1939
Category: Family
Rated: PG Ranked: ****
----------------------------
Display options:
1. Highest to Lowest Ranking
2. Lowest to Highest Ranking
3. Filter by Rating
4. Filter by Category
5. Sorted movie queue
6. Exit Display Menu
Enter option: 6
Exiting Display Menu.
1. Display Movie Queue
2. Add Movie to Queue
3. Edit Movie in Queue
4. Remove Movie from Queue
5. Search for Movie in Queue
6. Exit Profile
Enter option: 6
Welcome to the Netflix Movie Menu!
Please select (or create a profile:
1. Dad's Profile
2. Sarah
3. Add New Profile
4. Exit Program
Enter Option: 3
Enter Profile Label: Corey's Profile
Enter First Name: Corey
Enter Last Name: Doe
Enter Age: 15
Enter Number of Profile to Copy or 0 to create new profile: 1
Profile Created By Copying Dad's Profile (1)!
Welcome to the Netflix Movie Menu! Please select (or create) a profile:
1. Dad's Profile
2. Corey's Profile
3. Sarah
4. Add New Profile
5. Exit Program
Enter Option: 5
Exit Program. Good Bye!