Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please Write in Eclipse Java. If possible please add comments in code because I am still new to coding. Objective: Write a program where a
Please Write in Eclipse Java.
If possible please add comments in code because I am still new to coding.
Objective: Write a program where a user can enter a number of songs into a playlist and then simulates the playlist being played. This solution requires the following A class Song Attributes: o Namc: thc namc of thc song o Artist: the name of the artist of the song o Total Length: the length of the song given in seconds. This is assumed to be positive and includes 0 o Current Time: the current second the song is on . Accessors and Mutators for all Attributes o Mutators MUST check for valid valucs . Other Methods o toString: has no parameters and returns a string with the name, artist, and total length o getTimeRemaining: This method returns (the total length - current time) A gencric Queue of your own crcation You may implement this as either an array or a linked list . Must have the methods o Enqueue o Dequeue o Pcck o Print A class SongPlaylist Attributes: o Qucuc of Songs . Other Methods: o addSong: This method takes in an instance of a song and then adds it to the queue of songs. It returns nothing. o getCurrentSong: returns but does not remove the song that is at the beginning of the queue o advanceOneSecond: This advances the current song by one second. If the song's remaining time is less than 0, then it must remove the current song and start the next song when this mcthod is called ncxt A class SongPlaylistFrontEnd . A simple, front end where the user can add songs, play the playlist, or quit via the console. When playing the playlist it should print out information about the song every simulated second. You may use a loop with a counter to simulate time passing. Example Dialog: Welcome to the Song Playlist! Enter 1: to Add a Song Enter 2: to Start the Playlist Enter 9: to Quit Enter the name, the artist, and the total time (seconds) Test Song1 Test Artist 1 60 Enter 1: to Add a Song Enter 2: to Start the Playlist Enter 9: to Quit Enter the name, the artist, and the total time (seconds) Test Song2 Test Artist 2 30 Enter 1: to Add a Song Enter 2: to Start the Playlist Enter 9: to Quit Enter the name, the artist, and the total time (seconds) Test Song 3 Test Artist 3 90 Enter 1: to Add a Song Enter 2:to Start the Playlist Enter 9: to Quit Enter the name, the artist, and the total time (seconds) Test Song 4 Test Artist 4 120 Enter 1: to Add a Song Enter 2: to Start the Playlist Enter 9: to Quit Starting the Playlist Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time:0 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 1 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time:2 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time:3 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 4 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 5 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time:6 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 7 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time:8 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time:9 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 10 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 11 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 12 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 13 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 14 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 15 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 16 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 17 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 18 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 19 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 20 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 21 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 22 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 22 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 24 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 25 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 26 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 27 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 28 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 29 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 30 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 31 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 32 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 33 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 34 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 35 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 36 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 37 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 38 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 39 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 40 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 41 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 42 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 43 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 44 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 45 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 46 Objective: Write a program where a user can enter a number of songs into a playlist and then simulates the playlist being played. This solution requires the following A class Song Attributes: o Namc: thc namc of thc song o Artist: the name of the artist of the song o Total Length: the length of the song given in seconds. This is assumed to be positive and includes 0 o Current Time: the current second the song is on . Accessors and Mutators for all Attributes o Mutators MUST check for valid valucs . Other Methods o toString: has no parameters and returns a string with the name, artist, and total length o getTimeRemaining: This method returns (the total length - current time) A gencric Queue of your own crcation You may implement this as either an array or a linked list . Must have the methods o Enqueue o Dequeue o Pcck o Print A class SongPlaylist Attributes: o Qucuc of Songs . Other Methods: o addSong: This method takes in an instance of a song and then adds it to the queue of songs. It returns nothing. o getCurrentSong: returns but does not remove the song that is at the beginning of the queue o advanceOneSecond: This advances the current song by one second. If the song's remaining time is less than 0, then it must remove the current song and start the next song when this mcthod is called ncxt A class SongPlaylistFrontEnd . A simple, front end where the user can add songs, play the playlist, or quit via the console. When playing the playlist it should print out information about the song every simulated second. You may use a loop with a counter to simulate time passing. Example Dialog: Welcome to the Song Playlist! Enter 1: to Add a Song Enter 2: to Start the Playlist Enter 9: to Quit Enter the name, the artist, and the total time (seconds) Test Song1 Test Artist 1 60 Enter 1: to Add a Song Enter 2: to Start the Playlist Enter 9: to Quit Enter the name, the artist, and the total time (seconds) Test Song2 Test Artist 2 30 Enter 1: to Add a Song Enter 2: to Start the Playlist Enter 9: to Quit Enter the name, the artist, and the total time (seconds) Test Song 3 Test Artist 3 90 Enter 1: to Add a Song Enter 2:to Start the Playlist Enter 9: to Quit Enter the name, the artist, and the total time (seconds) Test Song 4 Test Artist 4 120 Enter 1: to Add a Song Enter 2: to Start the Playlist Enter 9: to Quit Starting the Playlist Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time:0 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 1 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time:2 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time:3 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 4 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 5 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time:6 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 7 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time:8 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time:9 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 10 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 11 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 12 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 13 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 14 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 15 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 16 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 17 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 18 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 19 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 20 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 21 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 22 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 22 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 24 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 25 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 26 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 27 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 28 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 29 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 30 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 31 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 32 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 33 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 34 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 35 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 36 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 37 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 38 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 39 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 40 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 41 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 42 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 43 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 44 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 45 Name: Test Song 1 Artist: Test Artist 1 Length: 60 Elapsed Time: 46
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