Question: using java you are going to develop a class to represent Songs. *For the instance variables, add the below ones. Make sure that these values

using java you are going to develop a class to represent Songs.

*For the instance variables, add the below ones. Make sure that these values cannot be accessed from other classes.

Name of the artist

Name of the song

Duration of the song(in seconds)

Play count

*Write at least two constructors (not the default one) (Hint: When you first create a song, play count should be 0)

*For this class, make sure you follow the encapsulation rules. (Add methods that you think are necessary for encapsulation)

*Add an additional play method that increases the play count.

*Override the toString method. Return everything in a proper format.

---------------------------------------

*Implement a class that will represent a Music Album that contains songs.

*For the instance variables, add the below ones. Make sure that these values cannot be accessed from other classes.

name of the album

number of songs

songs[]

*Write at least two constructors (not the default one)

*For this class, make sure you follow the encapsulation rules. (Add methods that you think are necessary for encapsulation)

*Write one additional method to add songs to this album.

*Write one additional method to search a song by the artist's name in this album. If you can find it, return it.

*Write one additional method to search a song by the song name in this album. If you can find it, return it.

*Write another method to decide the top song in this album which is the most played song and display it.

*Override the toString method. Return everything including the song names.

*Finally, use this class with a main method. Create a couple of songs. Then create an album with these songs. Play them randomly. Search the songs, call the necessary methods and at the end show us which song is the top song.

The general flow is up to you but make sure you call search methods, play method, add method and tostring methods.

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!