Question: b ) Add a constructor that takes two Strings and an int and uses them to initialize the Record object. This class will not have
b Add a constructor that takes two Strings and an int and uses them to
initialize the Record object. This class will not have a default constructor.
c Add an accessor method for each private instance variable. Mutators will not be
necessary.
d Add a void method called display that displays the record information in the
following format:
Title Artist YearReleased
For example, the record Unknown Pleasures by Joy Division, released would be
displayed as:
Unknown Pleasures Joy Division
e Add a boolean method called comesBefore that takes a Record object as a
parameter and compares the Record the method was called on this with the
Record passed as a parameter record
If the artist of this comes before the artist of record alphabetically,
return true. Use the compareToIgnoreCase method of the String
class to determine this.
If the record artists are the same, and the year this was released is
earlier than the year record was released, return true.
Otherwise return false.
Add a unit test for the Record class to your main class.
a Write a static void method called testComesBefore that takes two Record
objects as parameters and uses the comesBefore method to compare them.
b In the main method, create some Record objects and use testComesBefore to
test three cases:
The two records have different artists and the first one comes
alphabetically before the second.
The two records have the same artist and the first one was released
before the second.
The first record comes after the second record
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
