Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

4. Show the trainees how to do it again.

Answered: 1 week ago

Question

8. Praise the trainees for their success in learning the task.

Answered: 1 week ago