Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Main Class The main class should be called YourlastnameProgram 1 and has the following members: A private static void method called displayMenu that has

The Main Class
The main class should be called YourlastnameProgram1 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:
1. Add an album to the collection
2. Display the albums in the collection
3. Display the songs in the collection
4. Sort the albums in the collection
5. Add a song to the playlist
6. Display the playlist
7. Clear playlist
8. 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:
1. Prompt the user for an album title.
2. Prompt the user for an album artist.
3. Prompt the user for the number of tracks on the album until the user enters a value greater than zero.
4. Call the getTracklist method to prompt the user for the tracks on the album and get an array of Song objects.
5. 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:
1. Prompt the user for the title and length in minutes and seconds for each track.
2. Create a Song object for each track with the information provided and store it in an array of Song objects.
3. Return the array of Song objects.
A private static method called getAlbumFromCollection that takes an AlbumCollection as a parameter and does the following:
1. Prompt for the title and artist to search for.
2. Call the findAlbum method to find the album in the collection.
3. If the album is not found, display a message indicating that the album is not in the collection, and go back to step 1.
4. Otherwise return the album.
A private static method called getSongFromAlbum that takes an Album as a parameter and does the following:
1. Display the tracklist for the album.
2. Prompt the user to choose a track number.
3. Call the getTrack method to get the song with the given track number.
4. If the track number is not valid, go back to step 2.
5. Otherwise, return the song.
A main function that does the following:
1. Create an empty AlbumCollection and an empty Playlist
2. Display a welcome message.
3. Call displayMenu to display the menu.
4. Call getChoice to get the users choice.
5. If the choice is 1, call createAlbum to create a new album and add the album to the collection.
6. If the choice is 2, display the albums in the collection.
7. If the choice is 3, display the songs in the collection.
8. If the choice is 4, sort the albums in the collection.
9. If the choice is 5, call getAlbumFromCollection to select an album, call getSongFromAlbum to select a song, and add the song to the playlist.
10. If the choice is 6, display the playlist.
11. If the choice is 7, clear the playlist.
12. If the choice is 8, display a thank you message.
13. If the choice is any other value, display an error message.
14. Go back to step 3 unless the choice was 8.

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

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions