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.

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 12PE
icon
Related questions
Question

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.

145
146
147
148▾
149
150
151
152
153
154
155
156
157
158
159 ▼
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
191
}
public String getName() {
return name;
}
return sum;
public void tryToRegister Song (Song song) {
String str= "Registering "+song.getTitle()+" with budget $"+ String.format("%,d", budget) + ".";
if (favStudio==null)
str = str + "No preferred studio.";
}
}
else
{
}
str = str + "Prefers "+favStudio.getName();
if (!favStudio.isAvailable())
str+=" (Not available).";
str+=" (Available:cost [$"+String.format("%,d", favStudio.getCost())+"]).";
else
System.out.println(str);
//////IN THIS METHOD, DO NOT MODIFY ABOVE THIS LINE ///////////
/*Code for logic that can pass test cases 5, 6 and 7 can go here*/
public void addSong (String title) {
songs.add(new Song (title, genre, this ));
public ArrayList<Song) got Songs Of
/////
Transcribed Image Text:145 146 147 148▾ 149 150 151 152 153 154 155 156 157 158 159 ▼ 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 191 } public String getName() { return name; } return sum; public void tryToRegister Song (Song song) { String str= "Registering "+song.getTitle()+" with budget $"+ String.format("%,d", budget) + "."; if (favStudio==null) str = str + "No preferred studio."; } } else { } str = str + "Prefers "+favStudio.getName(); if (!favStudio.isAvailable()) str+=" (Not available)."; str+=" (Available:cost [$"+String.format("%,d", favStudio.getCost())+"])."; else System.out.println(str); //////IN THIS METHOD, DO NOT MODIFY ABOVE THIS LINE /////////// /*Code for logic that can pass test cases 5, 6 and 7 can go here*/ public void addSong (String title) { songs.add(new Song (title, genre, this )); public ArrayList<Song) got Songs Of /////
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Class
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:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT