Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LAB EXERCISES Figure 1 depicts the classes to which you will interface while completing the exercise. In class Singer,: a . Complete the first constructor

LAB EXERCISES
Figure 1 depicts the classes to which you will interface while completing the exercise.
In class Singer,:
a. Complete the first constructor that accepts name, genre, budget, as well as a reference to
the Ministry(incoming arguments include n for the name, g for genre, and b for budget).
b. Implement the second constructor so that ALL instance variables are initialized.
In class Song, write the calculation in method getEstEarnings of class Song to evaluate estimated
earnings. Note that while in the real world, other methods would be used to estimate earnings, in
this simplified model, the estimated earnings will be the length of the song title, multiplied by the
Ministry's songPartEst(hint.. the singer keeps a reference to the ministry. You can observe how the
reference is used in method getClaimableEarnings).
In class Singer, correct the method sumEstEarnings to evaluate the sum of estimated earnings for the
singer.
Record a song in a studio and try to register the song
a. Write a mutator in class Song named setStudio(Studio studio) that accepts a Studio, and sets
the associated studio on the song to the referenced Studio.
b. In method tryToRegisterSong of class Singer, so that if the Singer has a favourite Studio, and
the Studio is available, set the Studio on the Song to the favourite Studio.
Update logic in method tryToRegisterSong of class Singer to check if artist can afford the desired
studio before setting the studio on the song.
Update logic in method tryToRegisterSong of class Singer to allow ministry to suggest a studio by
calling the method getBestAvailableStudio(int budget, Studio preferred) from Ministry, which returns
a suggested studio. If the method returns a studio (returned value is not null) then set the studio for
the song to the returned studio if the singer is able to afford it. Add a song to the list of registered
songs only if the song is linked to a studio.
Update logic in method tryToRegisterSong of class Singer to ensure singer's budget is reduced by the
cost of the studio if registration is successful.
Update logic in method tryToRegisterSong of class Singer to ensure the Studio has a record of the
Song after registration, by calling the Studio's reserve method, with the Song as an argument.
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions