Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA question Implement the following three classes with all of the listed functionality: ratings.Song - In the ratings package, create a class named SongThis class

JAVA question

Implement the following three classes with all of the listed functionality:

ratings.Song - In the ratings package, create a class named SongThis class will have a constructor that takes 3 parameters in this order:

A String representing the title of the Song

A String representing the artist of the Song

A String representing the Songs ID

Implement getter and setter methods for the three constructor parameters named:

getTitle

setTitle

getArtist

setArtist

getSongID <-- Note that both characters in ID are capital

setSongID

For this task, you don't need to implement any additional methods in the Song class.

ratings.Rating - In the ratings package, create a class named RatingThis class will have a constructor that takes 2 parameters in this order:

A String representing the ID of the reviewer who gave the rating

An int representing the rating that the reviewer gave

Implement getter and setter methods for the two constructor parameters named:

getReviewerID

setReviewerID

getRating

setRating

Ratings must be in the range 1-5. If someone calls setRatings with an invalid rating, the rating should be set to -1 to indicate that an error has occurred. (eg. setRating(100) should result in the rating being set to -1)

It is good practice to have your constructor call your setter methods. If your constructor calls setRating, you only have to write code that checks for invalid ratings once and call that code whenever needed.

ratings.Reviewer - In the ratings package, create a class named ReviewerThis class will have a constructor that takes 1 parameter:

A String representing the ID of the reviewer

Implement getter and setter methods for the constructor parameter named:

getReviewerID

setReviewerID

Implement a method named rateSong that takes an int as a parameter and returns a new Rating object with this reviewer's ID and the rating from the parameter.

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

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions