Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

done in python language in 1 day. Jukebox In this task we are going to make our own Music Jukebox. This jukebox consists of a

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

done in python language in 1 day.

Jukebox In this task we are going to make our own Music Jukebox. This jukebox consists of a customized song playlist. Your jukebox is multi-functional and provide a number of functionalities. The most important functionality is storing songs in the list. The jukebox should allow us to adding and removing songs in our list. It also allows us to marking and unmarking songs as favorites. Interestingly, the box automatically adds a song into favorite if it is played more than thrice. Obliviously, there should be a functionality to play any specific song or playing the entire list or only favorite songs. It also returns the list of songs in the sorted format. This functionality required for a huge list of songs. The functionality of your implementation would be tested against a huge list of songs. Therefore, developers decided to implement using a Linked List. In this case, a linked list will be list of songs. We will be maintaining two linked lists: one for playlist and another for favorites songs. We will be having a class to store information about a song such as song name and singer. Another class will be required to providing mechanism for adding and removing songs in playlist and favorites. Implementation: You are required to implement: 1. Create a class MySongs that stores the information of song name, artist's name and the number of times the song played. 2. Create a class JukeNode to create a node for the linked list. 3. Create a class MyJukeBox and write the following functions in the class. a. Write a function InsertSong) that inserts a song in the list. The insertion should be done in O(1). b. Write a function PlaySong() that plays a specific song from the list. This function will print the -playing - on the screen (replace with the title of the song. We should also count the number of a times a song is played. C. Write a function DeleteSong) that deletes a song from the list. Make sure if a song is deleted from the list then it should also be deleted from favorites. The function should print "" has been deleted" on the screen after deletion (replace with title of the song). d. Write a function AddtoFavl) that adds a song to favorite. If a song is played more than 3 times then it automatically adds into favorite list. The function should print "_" has been added to favorites" on the screen after deletion (replace with title of the song). e. Write a function PlayList() that plays all songs of the list one by one such that the song which added first must play first. f. Write a function PlayFavtl) that plays all songs that are added in favorites such that the song which marked favorite first must play first. g. Write a function GetFavl) that returns a python list containing objects of class MySongs for only those songs which are added in the favorite. h. Write a function SortSongsl) that returns a python list containing object of class MySongs sorted alphabetically w.r.t artist's names. Template code: class JukeBox: # you can add further functions / attributes def_init__(self): #initialize lists to store playlist and favorites self.playlist head = None self.favt head = None pass def InsertSong(self, title, artist): # create a node and add in the list pass def PlayList (self): WA pass def PlayFav(self): pass det PlaySong(self, title): pass def AddToFav(self, song): pass def GetFav(self): pass def Delete Song(self, title): pass def Sort(self): pass Sample Output: See the attached template provided with the exam for the exact name and signature of each function. Cadunpie. Obj = MyJukebox) Obj.InsertSong("Radioactive","Imagine Dragons") Obj.InsertSong("Girls Like you", "Maroon5") Obi.InsertSong("Demons"mImagine Dragons") Obi.PlaySong("Demons") Obi.PlaySong("Girls Like you") Obi.PlaySong("Girls Like you") Obi.PlaySong("Girls Like you") Obj.AddtoFav() songlist = Obj.SortSongs() Obi.Delete Song("Radioactive") The results should be: - playing Demons- -playing Girls Like you- -playing Girls Like you- -playing Girls Like you- "Girls Like you' has been added to favorites Radioactive has been deleted from the list. Jukebox In this task we are going to make our own Music Jukebox. This jukebox consists of a customized song playlist. Your jukebox is multi-functional and provide a number of functionalities. The most important functionality is storing songs in the list. The jukebox should allow us to adding and removing songs in our list. It also allows us to marking and unmarking songs as favorites. Interestingly, the box automatically adds a song into favorite if it is played more than thrice. Obliviously, there should be a functionality to play any specific song or playing the entire list or only favorite songs. It also returns the list of songs in the sorted format. This functionality required for a huge list of songs. The functionality of your implementation would be tested against a huge list of songs. Therefore, developers decided to implement using a Linked List. In this case, a linked list will be list of songs. We will be maintaining two linked lists: one for playlist and another for favorites songs. We will be having a class to store information about a song such as song name and singer. Another class will be required to providing mechanism for adding and removing songs in playlist and favorites. Implementation: You are required to implement: 1. Create a class MySongs that stores the information of song name, artist's name and the number of times the song played. 2. Create a class JukeNode to create a node for the linked list. 3. Create a class MyJukeBox and write the following functions in the class. a. Write a function InsertSong) that inserts a song in the list. The insertion should be done in O(1). b. Write a function PlaySong() that plays a specific song from the list. This function will print the -playing - on the screen (replace with the title of the song. We should also count the number of a times a song is played. C. Write a function DeleteSong) that deletes a song from the list. Make sure if a song is deleted from the list then it should also be deleted from favorites. The function should print "" has been deleted" on the screen after deletion (replace with title of the song). d. Write a function AddtoFavl) that adds a song to favorite. If a song is played more than 3 times then it automatically adds into favorite list. The function should print "_" has been added to favorites" on the screen after deletion (replace with title of the song). e. Write a function PlayList() that plays all songs of the list one by one such that the song which added first must play first. f. Write a function PlayFavtl) that plays all songs that are added in favorites such that the song which marked favorite first must play first. g. Write a function GetFavl) that returns a python list containing objects of class MySongs for only those songs which are added in the favorite. h. Write a function SortSongsl) that returns a python list containing object of class MySongs sorted alphabetically w.r.t artist's names. Template code: class JukeBox: # you can add further functions / attributes def_init__(self): #initialize lists to store playlist and favorites self.playlist head = None self.favt head = None pass def InsertSong(self, title, artist): # create a node and add in the list pass def PlayList (self): WA pass def PlayFav(self): pass det PlaySong(self, title): pass def AddToFav(self, song): pass def GetFav(self): pass def Delete Song(self, title): pass def Sort(self): pass Sample Output: See the attached template provided with the exam for the exact name and signature of each function. Cadunpie. Obj = MyJukebox) Obj.InsertSong("Radioactive","Imagine Dragons") Obj.InsertSong("Girls Like you", "Maroon5") Obi.InsertSong("Demons"mImagine Dragons") Obi.PlaySong("Demons") Obi.PlaySong("Girls Like you") Obi.PlaySong("Girls Like you") Obi.PlaySong("Girls Like you") Obj.AddtoFav() songlist = Obj.SortSongs() Obi.Delete Song("Radioactive") The results should be: - playing Demons- -playing Girls Like you- -playing Girls Like you- -playing Girls Like you- "Girls Like you' has been added to favorites Radioactive has been deleted from the list

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago

Question

4. Identify the challenges facing todays organizations

Answered: 1 week ago