To construct a Song, a title and duration should be passed into its constructor. A new song will begin with no likes nor dislikes. If an invalid value is passed for title, default to "Untitled Song". If an invalid value is passed for the duration of a song, default to 5 minutes. A Song should also support the following behaviors: compareTo() - Songs should be compared to each other based on their like factor A song's like factor is the difference between its number of likes and number of dislikes equals() -Should override Object's equals() method -A Song is equal to another Song if they have the same title, duration, likes, and dislikes. toString() Returns String in the format: {title}, Duration: (duration), Likes: (likes), Dislikes: {dislikes} Getter and setter methods for instance variables as required. For setters, note that if an invalid value is passed in, you should not modify the value of the instance variable. Any additional methods required to satisfy the interfaces Song implements.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

Problem Description: Greetings aspiring music enthusiasts! You have been recruited by a top music streaming service to develop a cutting-edge music player application! Your mission is to create an app that allows users to
manage their playlists and listen to their favorite tunes.

The Challenge: The music industry faces a critical challenge – users crave a personalized and engaging 
way to experience their favorite tunes! Your mission is to create an innovative application that goes 
beyond basic playback.

Your Objectives: Develop the Maestro’s Toolkit: Define a robust music player which involves Users, Playlists, 
and Songs. Each user will be able to create and manage their personal music collections using Playlists, which have a variety of Songs.

Craft the Perfect Symphony: Implement functionalities that make your music player stand out!

  • Seamless Playlist Management: Users should be able to create or delete Playlists. Additionally, the functionality to customize existing Playlists is crucial.
  • Curated Listening Experience: Let Users express their preferences through like and dislike functionality on both Playlists and Songs. Additionally, we want to allow Users to customize their Playlist with features like selecting the top and worst Song in the Playlist.
  • Advanced Music Control: Users should be able to “play” and “pause” songs on demand.

By successfully completing this mission, you'll not only develop valuable programming skills, but you'll 
also establish yourself as a legendary Music Maestro, crafting extraordinary musical experiences for all!

Solution Description: In the interest of encapsulation, data members for the following class should only be 
accessible from other classes using getters and/or setters where needed. The described methods and 
constructors for this assignment should be public. It is OK to write private helper methods. When you write your 
solution, you’ll need to exactly match the instance variable names listed in this document. Further, your 
Strings should exactly match our expected format. Minor discrepancies, including whitespace and 
punctuation issues, can result in failed test cases.

  • The String formats in the PDF sometimes wrap to another line due to their length -- you are not 
    expected to include newline characters in them.
To construct a Song, a title and duration should be passed into its constructor. A new song will begin
with no likes nor dislikes.
If an invalid value is passed for title, default to "Untitled Song".
If an invalid value is passed for the duration of a song, default to 5 minutes.
A Song should also support the following behaviors:
•
compareTo()
Songs should be compared to each other based on their like factor
A song's like factor is the difference between its number of likes and number of dislikes
equals()
-Should override Object's equals() method
A Song is equal to another Song if they have the same title, duration, likes, and dislikes.
toString()
- Returns String in the format:
{title}, Duration: (duration}, Likes: (likes), Dislikes:
{dislikes}
Getter and setter methods for instance variables as required. For setters, note that if an invalid
value is passed in, you should not modify the value of the instance variable.
Any additional methods required to satisfy the interfaces Song implements.
Transcribed Image Text:To construct a Song, a title and duration should be passed into its constructor. A new song will begin with no likes nor dislikes. If an invalid value is passed for title, default to "Untitled Song". If an invalid value is passed for the duration of a song, default to 5 minutes. A Song should also support the following behaviors: • compareTo() Songs should be compared to each other based on their like factor A song's like factor is the difference between its number of likes and number of dislikes equals() -Should override Object's equals() method A Song is equal to another Song if they have the same title, duration, likes, and dislikes. toString() - Returns String in the format: {title}, Duration: (duration}, Likes: (likes), Dislikes: {dislikes} Getter and setter methods for instance variables as required. For setters, note that if an invalid value is passed in, you should not modify the value of the instance variable. Any additional methods required to satisfy the interfaces Song implements.
Song.java
Song is a class that represents a song in your music application. Playlists hold Songs and Songs
can be liked, disliked, and compared to each other. Therefore, Song should implement Comparable
and Likeable.
Each Song has several attributes, including:
⚫ title
- Represents the title of the song.
The title of a song should never be null.
duration
- Represents the duration of the song in minutes (int).
The duration of the song should never be negative nor exceed 10 minutes.
likes
Represents the number of likes for a song.
dislikes
-
Represents the number of dislikes for a song.
Transcribed Image Text:Song.java Song is a class that represents a song in your music application. Playlists hold Songs and Songs can be liked, disliked, and compared to each other. Therefore, Song should implement Comparable and Likeable. Each Song has several attributes, including: ⚫ title - Represents the title of the song. The title of a song should never be null. duration - Represents the duration of the song in minutes (int). The duration of the song should never be negative nor exceed 10 minutes. likes Represents the number of likes for a song. dislikes - Represents the number of dislikes for a song.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT