BLG 233E DATA STRUCTURES HOMEWORK -2 solution

$29.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (4 votes)

In this assignment, you are required to build up an extension of the linked list data structure, combining multi-lists, doubly linked lists and circular list structures. A diagram of the structure is given below. You are required to write this application by yourself. Structure:

Chronological Sorted Random Slow
BCDA Slow
CDAB Jazz
ABCD Slow
DABC Jazz
ABCD Slow
BCDA Slow
CDAB Jazz
DABC Jazz
CDAB Jazz
BCDA Slow
DABC Jazz
ABCD Slow
ABCD Slow
BCDA Slow
Head nodes
#define SNAME_LENGTH 50 #define LNAME_LENGTH 50 #define STYLE_LENGTH 30 #define SINGER_LENGTH 50
struct song { char* name = new char[SNAME_LENGTH]; char* singer = new char[SINGER_LENGTH]; char* style = new char[STYLE_LENGTH]; int year; };
struct song_node { song* data; song_node* next; song_node* prev; playlist* parent; };
struct playlist { int songnumber; char* name = new char[LNAME_LENGTH]; song_node* head; playlist* next; playlist* prev; };
//add file definitions and functions as needed. struct list { int playlist_count; playlist* head; };
Your assignment is to simulate a music player with a sequence of playlists. The user will be allowed to create new playlists, add new songs to any previously created playlists, play songs, and navigate (both forward and backward) through playlists.
By default, three playlists (chronological, sorted and random) will be created at the beginning of the program. The chronological playlist will be sorted by year, while the sorted playlist will be sorted first by singer name, then by song name. The random playlist is a shuffle playlist and should be reshuffled at each request. It will also be possible to create other custom playlists (e.g. the slow playlist in the example) on demand.
Program Work Flow
1. First, read the records from the file named “songbook.txt” provided with HW2.
There are several records in songbook.txt. Each row of the file corresponds to a different record. The parameters of each record are separated by a single tab character (‘\t’).