Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

REQUIRED IN PYTHON CODE Code Template: CODE'S OUTPUT SAMPLE Need this to be implemented in Python code In this task we are going to make

REQUIRED IN PYTHON CODE

image text in transcribed

image text in transcribedimage text in transcribed

Code Template:

image text in transcribed

CODE'S OUTPUT SAMPLE

image text in transcribed

Need this to be implemented in Python code

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. 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 AddtoFav() 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 PlayFavt() that plays all songs that are added in favorites such that the song which marked favorite first must play first. g. Write a function GetFav() that returns a python list containing objects of class MySongs for only those songs which are added in the favorite. h. Write a function SortSongs() that returns a python list containing object of class MySongs sorted alphabetically w.r.t artist's names. class My Song: # you can add further functions / attributes def _init_(self, title, artist): self.title title self.artist = artist 1 class JukeNode: # you can add further functions / attributes def __init__(self, my song): self.mySong = my song self.next = None self.previous = None 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): pass def PlayFav(self): pass def PlaySong(self, title): pass def AddToFav(self, song): pass def GetFav(self): pass def DeleteSong (self, title): pass def Sort(self): pass Example: Obj = My Jukebox () Obj. Insert Song ("Radioactive","Imagine Dragons") Obj. InsertSong ("Girls Like you", "Maroon5") Obj.Insert Song ("Demons","Imagine Dragons") Obj.PlaySong ("Demons") Obj.PlaySong ("Girls Like you") Obj. PlaySong ("Girls Like you") Obj.PlaySong ("Girls Like you") Obj.AddtoFav () songlist = Obj.Sort Songs () Obj.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

Recommended Textbook for

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

Students also viewed these Databases questions