Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The Ministry of Vybsie_Culcha intends to implement a grant for singers in order to offset difficulties experienced from the pandemic. The grant is to be
The Ministry of Vybsie_Culcha intends to implement a grant for singers in order to offset difficulties experienced from 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 controversial) strategy that requires entertainers to prove they are the song owners by recording it at a Studio, even if already released. The Ministry maintains a list of Studios, and code for the Ministry and Studio classes have already been fully 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 six(6) tasks that complete the Singer and Song classes. MARKING CRITERIA (PLEASE REVIEW BEFORE STARTING) Code passes all test cases, good programming style (5 marks) Accessors and mutators for Singer and Song (1 mark) Explanation of the importance of the toString method (1 mark) Correct implementation of logic to sum song values (1 mark) Explanation of your logic for tryToRegisterSong() (2 marks) Note that where convenient, you may declare private (support) methods. LAB EXERCISES 1. Complete constructors for the Singer class: a. Complete the first constructor that accepts name, genre, budget, as well as a reference to the Ministry. b. Complete the second constructor so that all instance variables are initialized. 2. Write code for the class Song to include: a. A constructor that accepts the song title, genre, singer and studio that relate to the song then sets instance variables b. A method 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). C. A toString() method that returns a string with data formatted as illustrated below if the song is a best seller: **Title, Genre, but the format : Title, Genre if the song is not a best seller. Note that a song is a best seller if the expected earnings exceed a value that is extracted from the ministry using the method getBestseller Limit 3. Complete the method in Singer named tryToRegisterSong: so that it executes the following logic... If the singer has a favourite studio that is available and within budget, use the favourite studio to record the song. Otherwise get the best available studio from the ministry within the singer's budget (simply call ministry.getBestAvailStudio(budget) for that). If the singer is successful in selecting a studio, proceed with registering the song by reserving the studio and reducing budget by the cost of the studio. The singer should also add the song to a list of songs. To keep information on a song, remember that the singer needs to note the title, the genre, as well as the studio. Of course, it is also important for each singer to note him/herself as the singer on the song. Input Format The first line contains integers t, f, m, v and b, where t is the number of test cases, f is the value of available funds, m is the minimum grant request to be entertained, v is the value of each character in calculating song value, and b is the lower limit(-1) for a song to be regarded a best seller. t test cases follow. Each test case begins with the name of a singer, a genre, a budget, and, optionally a favourite studio. The next line contains an integer s that indicates the number of songs the singer will attempt. s lines follow. Each of the s lines contain a string that represents the name of a song. Output Format as defined Sample Input o 1 10000000 100000 20000 500000 Iron_Balloon Waan_Buss 50000 Sample Output o ===APPLICATIONS NOT GRANTED==================== IRON_BALLOON: : Request for $0 declined: minimum intellectual property for grants is $100,000 Sample Input 1 1 1 10000000 100000 20000 500000 Iron_Balloon Waan_Buss 50000 1 0 Sample Output 1 ===APPLICATIONS NOT GRANTED=== IRON_BALLOON[Studio One] :: Request for $0 declined: minimum intellectual property for grants is $10,000,000 Sample Input 2 1 10000000 100000 10000 500000 One_hit_wonder Waan_Buss 50000 1 Mary_had_a_little_lamb Sample Output 2 =======GRANTS AWARDED=== ONE_HIT_WONDER::GRANTED $220,000 SONGS SUPPORTED Mary_had_a_little_lamb, Waan_Buss, [$10,000] Sample Input 3 1 10000000 100000 20000 500000 Shen_Yengz Dancehall 100000 2 1 Youre_the_one_I_love_so_I_will_run_run_run Sample Output 3 ====GRANTS AWARDED== SHEN_YENGZ[Rich Entertainment] :: GRANTED $840,000 SONGS SUPPORTED **Youre_the_one_I_love_so_I_will_run_run_run, Dancehall, [$40,000] Sample Input 4 2 10000000 100000 20000 500000 Iron_Balloon Waan_Buss 50000 1 1 Wha? Shen_Yengz Dancehall 100000 2 2 Youre_the_one_I_love_so_I_will_run_run_run Lighter Sample Output 4 ====GRANTS AWARDED========= SHEN_YENGZ[Rich Entertainment] :: GRANTED $980,000 SONGS SUPPORTED Sample Output 4 =====GRANTS AWARDED== SHEN_YENGZ[Rich Entertainment]::GRANTED $980,000 SONGS SUPPORTED **Youre_the_one_I_love_so_I_will_run_run_run, Dancehall, [$40,000] Lighter, Dancehall, [$40,000] ======APPLICATIONS NOT GRANTED==== IRON_BALLOON [Studio One] : : Request for $80,000 declined:minimum intellectual property for grants is $100,000 Sample Input 5 1 50000000 100000 20000 500000 Agent_Sasco Dancehall 140000 3 5 Banks_of_the_Hope Winning_right_now Mama_Prayed Sasco_vs_Assassin Loco Sample Output 5 ==========GRANTS AWARDED======================== AGENT_SASCO[Eight76 Music]:: GRANTED $1,320,000 SONGS SUPPORTED Banks_of_the_Hope, Dancehall,[$80,000] Winning_right_now, Dancehall, [$10,000] Mama_Prayed, Dancehall,[$10,000] Sasco_vs_Assassin, Dancehall,[$10,000] Loco, Dancehall, [$10,000] Sample Input 6 7 5000000 200000 20000 500000 Iron_Balloon Waan_Buss 25000 O 3 Wha? Yow! Far_In_Wi_Seh! Shen_Yengz Dancehall 100000 2 2 Youre_the_one_I_love_so_I_will_run_run_run Lighter Agent Sasco Dancehall 140000 3 5 Banks_of_the_Hope Winning_right_now Mama_Prayed Sasco_vs_Assassin Loco Adele Soul 400000 2 Go_easy_on_me Water_under_the_bridge_when_we_were_young Tessanne_Chin Rock 400000 2 Messenger One_Step_closer Tracy_Chapman Blues 400000 3 All_that_you_have Fast_Car Subcity Poppy Dancehall 500000 3 1 Unrulyrulyrulyrulyrulyrulyrulyrulyrulyrulyrulyrulyruly!!!! Sample Output 6 =====GRANTS AWARDED=: SHEN_YENGZ[Rich Entertainment] :: GRANTED $980,000 SONGS SUPPORTED **Youre_the_one_I_love_so_I_will_run_run_run, Dancehall, [$40,000] Lighter, Dancehall, [$40,000] AGENT_SASCO[Eight76 Music]::GRANTED $1,320,000 SONGS SUPPORTED Banks of the Hone. Dancehall 1680.0001 Sample Output 6 ========GRANTS AWARDED====== EEEEEEEEEE SHEN_YENGZ[Rich Entertainment] :: GRANTED $980,000 SONGS SUPPORTED **Youre_the_one_I_love_so_I_will_run_run_run, Dancehall, [$40,000] Lighter, Dancehall, [$40,000] AGENT_SASCO[Eight76 Music]:: GRANTED $1,320,000 SONGS SUPPORTED Banks_of_the_Hope, Dancehall, [$80,000] Winning_right_now, Dancehall, ($10,000] Mama_Prayed, Dancehall, ($10,000] Sasco_vs_Assassin, Dancehall, ($20,000] Loco, Dancehall, [$20,000] ADELE::GRANTED $1,080,000 SONGS SUPPORTED Go_easy_on_me, Soul, [$20,000] **Water_under_the_bridge_when_we_were_young, Soul, [$20,000] TESSANNE_CHIN::GRANTED $480,000 SONGS SUPPORTED Messenger, Rock, [$40,000] One_Step_Closer, Rock, [$40,000] TRACY_CHAPMAN::GRANTED $640,000 SONGS SUPPORTED All_that_you_have, Blues, [$80,000] Fast_Car, Blues, [$80,000] Subcity, Blues, [$80,000] ====APPLICATIONS NOT GRANTED==================== IRON_BALLOON[Ruff Gong] :: Request for $160,000 declined: minimum intellectual property for grants is $200,000 POPPY[Eight76 Music]:: Request for $1,160,000 declined: Insufficient funds in grant pool Java 8 8 1, import java.util.ArrayList; 2 import java.io.*; 3 4 5, class Song { 6 7 private String title, genre; Singer singer; 9 Studio studio; 10 11 public Song (String title, String genre, Singer singer, Studio studio) 12 { 13 this.studio = studio; 14 } 15 16 public int getEstEarnings () { 17 18 return 0; 19 } 20 21 22 private boolean is Bestseller() { 23 //Can use this to help complete toString 24 return getEstEarnings () >singer.getMinistry().getBestselllimit(); 25 } 26 27 28 } 29 30 31 class Singer { 32 33 private String name="", , genre; 34 private int budget; 35 private Studio favStudio; 36 private ArrayList
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started