1. In class Singer, method tryToRegisterSong, if the singer has a preferred studio, set studio to the preferred studio (use method setStudio()), then add the song to the list of registered songs. 2. In class Singer, method tryToRegisterSong, update logic to check if artist can afford studio before setting the studio on the song. 3. In class Singer, method tryToRegisterSong, update logic 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. You can then check if the song has been connected with a studio, and if it is, add the song to the list of registered songs. 4. In class Singer, method tryToRegisterSong , ensure singer’s budget is reduced by the cost of the studio. 5. In class Singer, method tryToRegisterSong , call the Studio’s reserve method when adding a song to the list of registered songs. Also, check to see if a studio is available (using the isAvailable() method in the studio class) before assigning the song to the studio.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
1. In class Singer, method tryToRegisterSong, if the singer has a preferred studio, set studio to
the preferred studio (use method setStudio()), then add the song to the list of registered songs.
2. In class Singer, method tryToRegisterSong, update logic to check if artist can afford studio before
setting the studio on the song.
3. In class Singer, method tryToRegisterSong, update logic 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. You can then check if the song has
been connected with a studio, and if it is, add the song to the list of registered songs.
4. In class Singer, method tryToRegisterSong , ensure singer’s budget is reduced by the cost of the
studio.
5. In class Singer, method tryToRegisterSong , call the Studio’s reserve method when adding a song to
the list of registered songs. Also, check to see if a studio is available (using the isAvailable() method in
the studio class) before assigning the song to the studio.
Step by step
Solved in 2 steps