logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

You will create an application that allows the user to select to skip backward / forward, play a track, append, and go to the beginning or the end.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Music Streaming Application

Implementing a Doubly Linked List

1.0 Objective

This project is meant to help you develop skills at working with linked lists and writing entire programs from scratch. In this project, you will only be provided with a project description and list of program requirements. No code will be provided at all. This means you will need to learn to design and implement an entire program on your own.

2.1   Basic Program

You are going to create a modified double-linked list as the data structure for a playlist as part of a music streaming application. You will create an application that allows the user to select to skip backward / forward, play a track, append, and go to the beginning or the end.

You will be given an input file with music track titles from three different albums. These tracks are in random order. You are to read in the titles and place them into a data structure in the order in which you read them in. Another data file will contain a list of the music tracks in the order that they appeared on the album. You are to create a doubly linked list that allows the music tracks to be stepped through in the sequence that they appeared on the album.

A third data file will contain a list of commands that you are to execute for each of the albums. Based on what the music player is doing after reading in the next input you will have to indicate what song the system is currently playing.

Once you have completed this, you are to read in the user's playlist which consists of music tracks from all three albums in any order. You are to create a doubly linked list for the playlist that will allow the user to play songs off of their playlist. You are then to read in the list of commands and execute them for the playlist.

Note that a list in python makes this a trivial assignment, but you aren't here to learn python you are here to learn data structures therefore you may NOT create a new list to replicate an ordered album. The data must always reside in the original data structure and no 'shadow' data structures are allowed to implement the album.

The solution to this homework can be implemented using either Python lists or Python objects.

If you come up with a solution that makes this problem trivial, then you are doing something wrong! Talk to me.

2.2   Files Names As Program Parameters

You must take both files, in the correct order, as query string arguments. To make life easier for the TAs, include the following code in your program:

import sys

if len(sys.argv) != 4:

raise ValueError('Please provide three file names.')

sys.argv[0] = sys.argv[0][0:len(sys.argv[0]) - sys.argv[0][::-1].find('/')] inputFile1 = sys.argv[0]+sys.argv[1]

inputFile2 = sys.argv[0]+sys.argv[2] inputFile3 = sys.argv[0]+sys.argv[3]

print("\nThe files that will be used for input are {0}, {1}, and

{2}".format(sys.argv[1],sys.argv[2],sys.argv[3]))

To pass the three file name arguments to your python program, in PyCharm run your program (it will fail) and then go to “Run > Edit Configurations” and set the Parameters value to

" HW2Songs.txt HW2Albums.txt HW2Commands.txt" (note no comma separating the file names) and save it.

2.3   Reading from a File

The album tracks will be in the input file in a random order. You are to read them in and place

them into a data structure IN THE ORDER THAT YOU READ THEM IN. Once you have done this, you will then create a doubly linked list for this album that will allow the user to sequence through the titles in the proper order that the titles appeared on the album.

To read the music playlist and the playlist commands from a file ("HW2Songs.txt", "HW2Albums.txt" and "HW2Commands.txt") you must first use the Python inputfile1 = open(filename,"r") command. At this point you can start reading from the file using variable = inputfile1.readline(). Do be careful, if you program can't find the file that it is looking for it will crash.

2.4   What is a Linked List?

 A linked list is a sequence data structure, which connects elements, called nodes, through links. Unlike an array data structure, a node in a linked list isn’t necessarily positioned close to the previous element or the next element. Nodes in a linked list are connected by pointers. Linked lists are null terminating, which means whenever the pointer to the next node is null, the list has reached the end.

2.5  Single Linked List

In single linked list, element or nodes only link to the next element in the list. A single linked list is null terminating meaning when the pointer is null, the list is finished.

2.5   Double Linked List

 In a double linked list, each node contains a reference to the previous node and the next node (as long as they aren’t the head or tail node.) Each node has a value property.

2.6   Doubly Linked List Properties

 The reason I chose a double linked list was that the structure suited the behavior of a music playlist.

· Skip Back/Forward

Because each node in a double linked list has a pointer the previous and next node, it is easy to implement skip forward/backward functionality.

 

· Play Next Track

The pointer to the next node also makes it quite easy to start the next track when a track is over.

 

·  Append

When you add a new track to a playlist, you tack it on to the end. In a linked list, adding a new element is constant time — O(1) operation. Note that as the songs are read in from the data file and added to the play list, this will be done as a sequence of calls to append.

 

· Beginning/End

Finally, because a linked list has head and tail properties, this provides for an easy way to delineate the beginning and end of a playlist.

(5/5)
Attachments:

Expert's Answer

939 Times Downloaded

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

939 Times Downloaded

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

688 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

671 Answers

Hire Me
expert
Husnain SaeedComputer science

997 Answers

Hire Me
expert
Atharva PatilComputer science

634 Answers

Hire Me