Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using Apache Netbeans create the code for a main class. The main class should be called Yourlastname and has the following members: A private static
Using Apache Netbeans create the code for a main class.
The main class should be called Yourlastname and has the following members:
A private static void method called displayMenu that has no parameters and displays the following menu:
Choose one of the following:
Add an album to the collection
Display the albums in the collection
Display the songs in the collection
Sort the albums in the collection
Add a song to the playlist
Display the playlist
Clear playlist
Exit the program
A private static method called getChoice that takes no arguments, reads an integer from the user, and returns it
A private static method called createAlbum that does the following:
Prompt the user for an album title.
Prompt the user for an album artist.
Prompt the user for the number of tracks on the album until the user enters a value greater than zero.
Call the getTracklist method to prompt the user for the tracks on the album and get an array of Song objects.
Create a new Album object with the title, artist, and track list provided and return it
A private static method called getTracklist that takes the number of tracks and the album artist as parameters and does the following:
Prompt the user for the title and length in minutes and seconds for each track.
Create a Song object for each track with the information provided and store it in an array of Song objects.
Return the array of Song objects.
A private static method called getAlbumFromCollection that takes an AlbumCollection as a parameter and does the following:
Prompt for the title and artist to search for.
Call the findAlbum method to find the album in the collection.
If the album is not found, display a message indicating that the album is not in the collection, and go back to step
Otherwise return the album.
A private static method called getSongFromAlbum that takes an Album as a parameter and does the following:
Display the tracklist for the album.
Prompt the user to choose a track number.
Call the getTrack method to get the song with the given track number.
If the track number is not valid, go back to step
Otherwise, return the song.
A main function that does the following:
Create an empty AlbumCollection and an empty Playlist
Display a welcome message.
Call displayMenu to display the menu.
Call getChoice to get the users choice.
If the choice is call createAlbum to create a new album and add the album to the collection.
If the choice is display the albums in the collection.
If the choice is display the songs in the collection.
If the choice is sort the albums in the collection.
If the choice is call getAlbumFromCollection to select an album, call getSongFromAlbum to select a song, and add the song to the playlist.
If the choice is display the playlist.
If the choice is clear the playlist.
If the choice is display a thank you message.
If the choice is any other value, display an error message.
Go back to step unless the choice was
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