Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

I really hope this is enough information for all 8 parts of the question to be fully answered. This practice lab question states: The Ministry

I really hope this is enough information for all 8 parts of the question to be fully answered. This practice lab question states:

The Ministry of Vybsie_Culcha intends to implement a grant for singers in order to offset difficulties experienced in the pandemic. The grant is to be funded from a fixed pool of funds so the first set of singers that exhaust the funds are the only ones that are able to receive the grant). You are contracted to write a program that models the expected payouts. in order to reduce the possibility of fraud however, the ministry has decided to

implement a controverslal strategy cal requires entertainers to prove uney are ine song owners by recording it at a Studio, even if already released. The Ministry maintains a list of Studios. and code for the Ministrv and Studio classes have alreadv been fullv

implemented. The starting code also includes calls to a template of a Singer class that interacts with a Song class. Your task is to execute eight(8) tasks that complete the Singer and song classes.

NOTE .: No part of Ministry or Studio should be modified. Note that where convenient, and allowed, vou mav declare private support methods.

Figure 1:Simplified UML Class Diagram for the exercise Figure 1 depicts the classes to which you will interface while completing the exercise.

1. 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 tne secona constructor so tat am instance variables are initanzea.

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 title, multiplied by the a value extracted by the ministry using the method getSongPartEst(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 estimates earnings for the singer

Record a song in a studio and try to register the song a. In class Song write a mutator

named setstudiostudio studio -method for the song that accepts a studio. and sets the associated studio on the on the song to the referenced Studio. b. 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

In class singer, method try loregistersong, update logic to check It artist can attord stualo berore setting tne studio on te song.

In class Singer, method tryToRegisterSong, update logic to allow ministry to suggest a studio by calling the method getBestAvailableStudioint 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.

In class Singer, method tryToRegisterSong, ensure singer's budget is reduced by the cost of the studio.

In class Singer, method tryloregistersong, 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.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Figure 1 depicts the classes to which you will interface while completing the exercise. 1. 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. 2. 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 title, multiplied by the a value extracted by the ministry using the method getSongPartEst(hint.. the singer keeps a reference to the ministry. You can observe how the reference is used in method getClaimableEarnings). 3. In class Singer, correct the method sumEstEarnings to evaluate the sum of estimates earnings for the singer. 4. Record a song in a studio and try to register the song a. In class Song write a mutator named setStudio(Studio studio)-method for the song that accepts a Studio, and sets the associated studio on the on the song to the referenced Studio. b. 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. 5. In class Singer, method tryToRegisterSong, update logic to check if artist can afford studio before setting the studio on the song. 6. 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. 7. In class Singer, method tryToRegisterSong, ensure singer's budget is reduced by the cost of the studio. 8. 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. private Ministry ministry; private int grantValue; private String grantMessage; private boolean willApply; public Singer(String n, String g, int b, Ministry min, boolean wantToApply) \{ //question 1 a ministry= min; songs = new Arraylist (); registeredSongs = new Arraylist (); /Q1. Add code to complete this constructor / grantMessage ="n; this. favStudio=null; willApply = wantToApply; \} public Singer(String name, String genre, int budget, int fav, Ministry ministry, boolean willapply ) \{ this. favStudio= ministry.getStudio (fav); /Q1b. Add code to complete this constructor / \} public Ministry getMinistry() \{ return ministry; \} public boolean applying() \{ return willapply; \} public boolean studioExists(Studio favStudio) \{ return (favstudio!=null) ; \} public boolean canAfford(Studio studio) \{ return studio.getCost () Processing request from Iron_Balloon for $0 singer SHEN_YENGZ[Rich Entertainment]:: Song (s) Released Youre_the_one_I_love_so_I_will_run_run_run as a Dancehall single to earn $840,000. Total earnable for Shen_Yengz =$840,000 Registering Youre_the_one_I_love_so_I_will_run_run_run with budget $100,000. Prefers Rich Entertainment (Available: cost[$60,000] ). Processing request from Shen_Yengz for $840,000 SHEN_YENGZ[Rich Entertainment]: : GRANTED $840,000 SONGS SUPPORTED Released Youre_the_one_I_love_so_I_will_run_run_run as a Dancehall single to earn $840,000. Sample Input 6 15000000010000020000500000 Yes Yes Agent_Sasco Dancehall 140000 Yes 3 5 Banks_of_the_Hope Winning_right_now Mama_Prayed Sasco_vs_Assassin Loco Sample Output 6 AGENT_SASCO[Eight76 Music] : : Song (s) Released Banks_of_the_Hope as a Dancehall single to earn $340,000. Released Winning_right_now as a Dancehall single to earn $340,000. Released Mama_Prayed as a Dancehall single to earn $220,000. Released Sasco_vs_Assassin as a Dancehall single to earn $340,000. Released Loco as a Dancehall single to earn $80,000. Total earnable for Agent_Sasco =$1,320,000 Registering Banks_of_the_Hope with budget $140,000.Prefers Eight76 Music (Available: cost[$80,000] ). Registering Winning_right_now with budget $60,000.Prefers Eight76 Music (Available: cost[$80,000] ). Ruff Gong is available for $10,000. \Assigned studio Ruff Gong. Registering Mama_Prayed with budget $50,000.Prefers Eight76 Music (Available: cost [$80,000] ). Ruff Gong is available for $10,000. >Assigned studio Ruff Gong. Registering Sasco_vs_Assassin with budget $40,000.Prefers Eight76 Music (Available: cost[$80,000] ). Ruff Gong is available for $10,000. >Assigned studio Ruff Gong. Registering Loco with budget $30,000. Prefers Eight76 Music (Available: cost [$80,000] ). Ruff Gong is available for $10,000. >Assigned studio Ruff Gong. >Processing request from Agent_Sasco for $1,320,000 =====================GRANTS AWARDED ===================== AGENT_SASCO[Eight76 Music]: :GRANTED $1,320,000 SONGS SUPPORTED Released Banks_of_the_Hope as a Dancehall single to earn $340,000. Released Winning_right_now as a Dancehall single to earn $340,000. Released Mama_Prayed as a Dancehall single to earn $220,000. Released Sasco_vs_Assassin as a Dancehall single to earn $340,000. Released Loco as a Dancehall single to earn $80,00. 7500000020000020000500000 Yes Yes Iron_Balloon Waan_Buss 25000 Yes 0 3 Wha? Yow! Far_In_Wi_Seh! Shen_Yengz Dancehall 100000 Yes 2 2 Youre_the_one_I_love_so_I_will_run_run_run Lighter Agent_Sasco Dancehall 140000 Yes 3 5 Banks_of_the_Hope Winning_right_now Mama_Prayed Sasco_vs_Assassin Loco Adele Soul 400000 Yes 2 Go_easy_on_me Water_under_the_bridge_when_we_were_young Tessanne_Chin Rock 406000 Yes 2 Messenger One_Step_closer Tracy_Chapman Blues 400000 Yes 3 All_that_you_have Fast_Car Subcity Poppy DanceHalL 500000 Yes 3 1 Unrulyrulyrulyrulyrulyrulyrulyrulyrulyrulyrulyrulyruly!!! ! Sample Output 7 Singer IRON_BALLOON [Ruff Gong] : : Song (s) Released Wha? as a Waan_Buss single to earn $80,000. Released Yow! as a Waan_Buss single to earn $80,000. Released Far_In_Wi_Seh! as a Waan_Buss single to earn $280,000. Total earnable for Iron_Balloon =$44,00 Registering Wha? with budget $25,000. Prefers Ruff Gong (Avai lable: cost [$10,00] ). Registering Yow! with budget $15,000. Prefers Ruff Gong (Avai lable:cost [$10,0] ). Registering Far_In_Wi_Seh! with budget $5,000. Prefers Ruff Gong (Avai lable: cost [$10,000] ). Ruff Gong is available for $10,000. > Studio One is available for $20,000. Rich Entertainment is available for $60,000. Eight76 Music is available for $80,000. Juss Buss is available for $160,000. \Assigned studio Ruff Gong. >Processing request from Iron_Balloon for $160,000 singer

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_2

Step: 3

blur-text-image_step3

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

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

ISBN: 0764532545, 978-0764532542

More Books

Students explore these related Databases questions