Question: Develop small java program that will let a user organize a music collection. Instead of a database you will be storing all the information in

Develop small java program that will let a user organize a music collection. Instead of a database you will be storing all the information in a file. Your program will be an interface to this file and provide a database-like functionality. The user of your program will be able to add songs to the file, delete songs, search for songs, or display everything on file.

The songs will be stored in a file called songs.txt.

In your program you will read in the data from the file, create a Song object for each song and store these objects in an array. Your program will be menu driven.The Menu can look similar to this.

1. Import songs from a file 2. Add a song 3. Delete a song 4. Search for a song 5. Display all songs 6. sort 7. Exit program Enter selection (1 - 7):

If the user does not enter a vaild selection, i.e. a number between 1 and 7 inclusive you will reprint the menu. For valid menu selection you will handle each case separately.

1. Import Songs from a File: You will prompt the user to enter the absolute path name to the file. Check if the file exists and is readable. The format for the data must be in the same form as songs.txt. Read the contents of the file and populate the array. Once you have processed the request reprint the menu.

2. Add a new song: You will prompt the user to enter the name of the artist and the title of the song.

Enter artist:

Enter title: If that song is already there, print a message to that effect. If the song is not there you will insert the song in its rightful place in the sorted array of songs. You will be using a variation of insertion sort for doing that. After you have processed this request you will reprint the main menu.

3. Delete a song: You will prompt the user to enter if the deletion will be by artist or title. For invalid entries prompt the user again. Depending on the valid response that you get, prompt the user to enter either the name of the artist or the title of the song.

Delete by artist or title (A or T): A

Enter artist: If the deletion is by artist name you will delete all songs by that artist. If the deletion is by song title, then you will delete only the entry for that song. If the artist or the title does not exist, you will write a message to that effect. After you have processed this request you will reprint the main menu.

4. Search for a song: You will prompt the user to enter if the search will be by artist or title. For invalid entries prompt the user again. Depending on the valid response that you get, prompt the user to enter either the name of the artist or the title of the song.

Search by artist or title (A or T): T

Enter title: If the search is by artist name, you will display all songs by that artist in the collection. If the search is by title you will display the name of the artist and the title in the collection. If the artist or the title does not exist then you will write a message to that effect. After you have processed this request you will reprint the main menu.

5. Display all songs: You will display all songs in the array. After you have processed the request you will reprint the main menu.

6. Users should be able to create ad hoc playlists by sorting in ascending or descending order based on song title or length in milliseconds User's should be able to filter this information by entering in the artist name or album title.

7. Exit program: You will over-write the file songs.txt with the modified array of songs in the original format. You will write a message thanking the user for using the software.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!