Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Cpts 122 - Data Structures Programming Assignment 2: Video Playlist Manager & Doubly Linked Lists - Part 1 Assigned: Friday, January 30, 2020 Due: Monday,
Cpts 122 - Data Structures Programming Assignment 2: Video Playlist Manager & Doubly Linked Lists - Part 1 Assigned: Friday, January 30, 2020 Due: Monday, February 10, 2020 by midnight I. Learner Objectives: At the conclusion of this programming assignment, participants should be able to: o Design and implement a dynamic doubly linked list O Allocate and de-allocate memory at runtime o Manipulate links in a dynamic list o Insert items into a dynamic linked list o Delete items from a dynamic linked list o Edit items in a dynamic linked list o Traverse a dynamic linked list II. Prerequisites: Before starting this programming assignment, participants should be able to: o Analyze a basic set of requirements for a problem o Compose C language programs o Create basic test cases for a program o Apply arrays, strings, and pointers o Summarize differences between array notation and pointer notation o Apply pointer arithmetic o Apply basic string handling library functions o Define and implement structures in C o Summarize the operations of a linked list III. Overview & Requirements: Many of us have utilized some type of video application (YouTube). It would be nice to have a program that would manipulate your video collection based on attributes such as Film Title, Running Time, Genre, Description, Year, Director. For this assignment you will write a basic video playlist manager. Your program must have a text-based interface which allows the user to select from a main menu of options including: (1) load, (2) store, (3) display, (4) insert, (5) delete, (6) edit, (7) sort, (8) rate, (9) play, (10) shuffle, and (11) exit. For Part of the assignment, you will only need to complete the main menu, (1) load, (2) store, (3) display, (6) edit, (8) rate, (9) play, and (11) exit features. The other features will be completed in the next part of the assignment. o What must the main menu contain? The main menu must display the following commands: (1) load (2) store (3) display (4) insert (5) delete (6) edit (7) sort (8) rate (9) play (10) shuffle (11) exit After a command is selected and completed, your program must display the main menu again. This procedure will continue until the "exit" command is selected. o What must "load" do? The "load" command must read all records from a file called moviePlayList.csv attached to the assignment on blackboard into a dynamic doubly linked list. The doubly linked list is considered the main playlist. As each record is read from the file, it must be inserted at the front of the list. Each record consists of the following attributes: 0 Film Title - a string o Director - a string o Description - a string o Genre - a string o Running Time - a struct Duration type consisting of hours and minutes, both integers o Year - an integer o Number times played - an integer o Rating - an integer (1 - 5) Each attribute, in a single record, will be separated by a comma in the .csv (comma separated values) file. This means that you will need to design an algorithm to extract the required attributes for each record. Each field in each record will have a value. You do not need to check for null or empty values. You must define a struct called Record to represent the above attributes. Also, do not forget that the Movie Length must be represented by another struct called Duration. Duration is defined as follows: 0 Hours - an integer O Minutes - an integer Finally, each struct Node in the doubly linked list must be defined as follows: o Data - a Record O Pointer to the next node o Pointer to the previous node o What must "store" do? The "store" command writes the current records, in the dynamic doubly linked list, to the moviePlayList.csv file. The store will completely overwrite the previous contents in the file. o What must "display" do? The "display" command prints records to the screen. This command must support three methods, one of which is selected by the user: 1. Print all movies. 2. Print all records that match a director. 3. Print all records that match a year. o What must "edit" do? The "edit" command must allow the user to find a record in the list by director. If there are multiple records with the same director, then your program must prompt the user which one to edit. The user may modify all of the attributes in the record. o What must "rate" do? The "rate" command must allow the user to assign a value of 1 - 5 to a movie; 1 is the lowest rating and 5 is the highest rating. The rating will replace the previous rating. o What must "play" do? The "play" command must allow the user to select a movie and must start "playing" each movie in order from the current movie. "Playing" the movie for this assignment means displaying the contents of the record that represents the movie for a short period of time, clearing the screen and showing the next record in the list, etc. This continues until all movies have been played. o What must "exit" do? The "exit" command saves the most recent list to the moviePlayList.csv file. This command will completely overwrite the previous contents in the file. IV. Logical Block Diagram The logical block diagram for your doubly linked list should look like the following: NULL Record 1: Film Title Director Description Genre Running Time Year Director Times Played Rating Record 1: Film Title Director Description Genre Running Time Year Director Times Played Rating Record 1: Film Title Director Description Genre Running Time Year Director Times Played Rating Record 1: Film Title Director Description Genre Running Time Year Director Times Played Rating NULL+ As you can see from the illustration a doubly linked list has a pointer to the next node and the previous node in the list. The first node's previous node pointer is always NULL and the last node's next pointer is always NULL. When you insert and delete nodes from a doubly linked list, you must always carefully link the previous and next pointers. V. Submitting Assignments: 1. Must submit your assignment in a zip file through blackboard. Your project must contain at least one header file (a .h file), two C source files (which must be .c files), and a local copy of the .csv file. Your project must build properly. The most points an assignment can receive if it does not build properly is 65 out of 100. VI. Grading Guidelines: This assignment is worth 100 points. Your assignment will be evaluated based on a successful compilation and adherence to the program requirements. We will grade according to the following criteria: o 5 pts - Appropriate top-down design, style, and commenting according to class standards. o 4 pts - For correct definition of struct Record. o 2 pts - For correct definition of struct Duration. o 3 pts - For correct definition of struct Node. o 5 pts - For correctly displaying the main menu, getting the command from the user, and executing the command. o 3 pts - For looping back to main menu after a command is executed. o 21 pts - For correctly constructing a doubly linked list, including: o (6 pts) For correct implementation for allocating space for a struct Node on the list, and initializing the node. o (9 pts) For correct implementation of insert Front function, which allocates a new node and adds it to the front of the DLL. Returns 1 for successfully allocating space for a node; O otherwise. o (6 pts) For correct implementation of printList(), which visits each node in the list and prints out the contents of the movie record. o 15 pts - Correct "load" command implementation. (2 pts) For correctly opening moviePlayList.csv for mode "read". (6 pts) For correctly extracting each attribute from each movie record in the file. o (5 pts) For correctly using insertFront O. o (2 pts) For correctly closing moviePlayList.csv. o 13 pts - Correct "store" command implementation, which writes the records in the list to the moviePlayList.csv file. O (3 pts) For opening musicPlayList.csv for mode "write". (10 pts) For correctly writing all the records in the list to the file, maintaining the .csv format. o 7 pts - For correct "display" command implementation. (2 pts) For displaying all records by using printList(). (5 pts) For searching for specific records based on director or year and displaying matching record - should be able to use the same search function as used in the "edit" command. o 7 pts - Correct "edit" command implementation. 0 (2 pts) For searching for specific records based on director - should be able to use the same search function as used in the "display" command. 0 (5 pts) For editing the record specified by the user. o 3 pts - Correct "rate" command implementation. o 7 pts - Correct "play" command implementation. (2 pts) For playing all movie in order until the end of the list. o (5 pts) For searching for specific movie based on movie title and playing all movies until the end of the list has been reached. o 5 pts - Correct "exit" command implementation, which writes the records in the list to the moviePlayList.csv file and exits the program. Cpts 122 - Data Structures Programming Assignment 2: Video Playlist Manager & Doubly Linked Lists - Part 1 Assigned: Friday, January 30, 2020 Due: Monday, February 10, 2020 by midnight I. Learner Objectives: At the conclusion of this programming assignment, participants should be able to: o Design and implement a dynamic doubly linked list O Allocate and de-allocate memory at runtime o Manipulate links in a dynamic list o Insert items into a dynamic linked list o Delete items from a dynamic linked list o Edit items in a dynamic linked list o Traverse a dynamic linked list II. Prerequisites: Before starting this programming assignment, participants should be able to: o Analyze a basic set of requirements for a problem o Compose C language programs o Create basic test cases for a program o Apply arrays, strings, and pointers o Summarize differences between array notation and pointer notation o Apply pointer arithmetic o Apply basic string handling library functions o Define and implement structures in C o Summarize the operations of a linked list III. Overview & Requirements: Many of us have utilized some type of video application (YouTube). It would be nice to have a program that would manipulate your video collection based on attributes such as Film Title, Running Time, Genre, Description, Year, Director. For this assignment you will write a basic video playlist manager. Your program must have a text-based interface which allows the user to select from a main menu of options including: (1) load, (2) store, (3) display, (4) insert, (5) delete, (6) edit, (7) sort, (8) rate, (9) play, (10) shuffle, and (11) exit. For Part of the assignment, you will only need to complete the main menu, (1) load, (2) store, (3) display, (6) edit, (8) rate, (9) play, and (11) exit features. The other features will be completed in the next part of the assignment. o What must the main menu contain? The main menu must display the following commands: (1) load (2) store (3) display (4) insert (5) delete (6) edit (7) sort (8) rate (9) play (10) shuffle (11) exit After a command is selected and completed, your program must display the main menu again. This procedure will continue until the "exit" command is selected. o What must "load" do? The "load" command must read all records from a file called moviePlayList.csv attached to the assignment on blackboard into a dynamic doubly linked list. The doubly linked list is considered the main playlist. As each record is read from the file, it must be inserted at the front of the list. Each record consists of the following attributes: 0 Film Title - a string o Director - a string o Description - a string o Genre - a string o Running Time - a struct Duration type consisting of hours and minutes, both integers o Year - an integer o Number times played - an integer o Rating - an integer (1 - 5) Each attribute, in a single record, will be separated by a comma in the .csv (comma separated values) file. This means that you will need to design an algorithm to extract the required attributes for each record. Each field in each record will have a value. You do not need to check for null or empty values. You must define a struct called Record to represent the above attributes. Also, do not forget that the Movie Length must be represented by another struct called Duration. Duration is defined as follows: 0 Hours - an integer O Minutes - an integer Finally, each struct Node in the doubly linked list must be defined as follows: o Data - a Record O Pointer to the next node o Pointer to the previous node o What must "store" do? The "store" command writes the current records, in the dynamic doubly linked list, to the moviePlayList.csv file. The store will completely overwrite the previous contents in the file. o What must "display" do? The "display" command prints records to the screen. This command must support three methods, one of which is selected by the user: 1. Print all movies. 2. Print all records that match a director. 3. Print all records that match a year. o What must "edit" do? The "edit" command must allow the user to find a record in the list by director. If there are multiple records with the same director, then your program must prompt the user which one to edit. The user may modify all of the attributes in the record. o What must "rate" do? The "rate" command must allow the user to assign a value of 1 - 5 to a movie; 1 is the lowest rating and 5 is the highest rating. The rating will replace the previous rating. o What must "play" do? The "play" command must allow the user to select a movie and must start "playing" each movie in order from the current movie. "Playing" the movie for this assignment means displaying the contents of the record that represents the movie for a short period of time, clearing the screen and showing the next record in the list, etc. This continues until all movies have been played. o What must "exit" do? The "exit" command saves the most recent list to the moviePlayList.csv file. This command will completely overwrite the previous contents in the file. IV. Logical Block Diagram The logical block diagram for your doubly linked list should look like the following: NULL Record 1: Film Title Director Description Genre Running Time Year Director Times Played Rating Record 1: Film Title Director Description Genre Running Time Year Director Times Played Rating Record 1: Film Title Director Description Genre Running Time Year Director Times Played Rating Record 1: Film Title Director Description Genre Running Time Year Director Times Played Rating NULL+ As you can see from the illustration a doubly linked list has a pointer to the next node and the previous node in the list. The first node's previous node pointer is always NULL and the last node's next pointer is always NULL. When you insert and delete nodes from a doubly linked list, you must always carefully link the previous and next pointers. V. Submitting Assignments: 1. Must submit your assignment in a zip file through blackboard. Your project must contain at least one header file (a .h file), two C source files (which must be .c files), and a local copy of the .csv file. Your project must build properly. The most points an assignment can receive if it does not build properly is 65 out of 100. VI. Grading Guidelines: This assignment is worth 100 points. Your assignment will be evaluated based on a successful compilation and adherence to the program requirements. We will grade according to the following criteria: o 5 pts - Appropriate top-down design, style, and commenting according to class standards. o 4 pts - For correct definition of struct Record. o 2 pts - For correct definition of struct Duration. o 3 pts - For correct definition of struct Node. o 5 pts - For correctly displaying the main menu, getting the command from the user, and executing the command. o 3 pts - For looping back to main menu after a command is executed. o 21 pts - For correctly constructing a doubly linked list, including: o (6 pts) For correct implementation for allocating space for a struct Node on the list, and initializing the node. o (9 pts) For correct implementation of insert Front function, which allocates a new node and adds it to the front of the DLL. Returns 1 for successfully allocating space for a node; O otherwise. o (6 pts) For correct implementation of printList(), which visits each node in the list and prints out the contents of the movie record. o 15 pts - Correct "load" command implementation. (2 pts) For correctly opening moviePlayList.csv for mode "read". (6 pts) For correctly extracting each attribute from each movie record in the file. o (5 pts) For correctly using insertFront O. o (2 pts) For correctly closing moviePlayList.csv. o 13 pts - Correct "store" command implementation, which writes the records in the list to the moviePlayList.csv file. O (3 pts) For opening musicPlayList.csv for mode "write". (10 pts) For correctly writing all the records in the list to the file, maintaining the .csv format. o 7 pts - For correct "display" command implementation. (2 pts) For displaying all records by using printList(). (5 pts) For searching for specific records based on director or year and displaying matching record - should be able to use the same search function as used in the "edit" command. o 7 pts - Correct "edit" command implementation. 0 (2 pts) For searching for specific records based on director - should be able to use the same search function as used in the "display" command. 0 (5 pts) For editing the record specified by the user. o 3 pts - Correct "rate" command implementation. o 7 pts - Correct "play" command implementation. (2 pts) For playing all movie in order until the end of the list. o (5 pts) For searching for specific movie based on movie title and playing all movies until the end of the list has been reached. o 5 pts - Correct "exit" command implementation, which writes the records in the list to the moviePlayList.csv file and exits the program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started