Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Template cade handles inputs Constraints Output Format as defined Sample Input 0 11000000019000020000500000 No No Sample Output 0 Sample Input 1 11 1006tede 100600 20ted

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Template cade handles inputs Constraints Output Format as defined Sample Input 0 11000000019000020000500000 No No Sample Output 0 Sample Input 1 11 1006tede 100600 20ted 500000 No No Tron_batleen Waan_lluss 59000 Mo 1 Sample Output 1 IRON_BALLOON[Studio one] It Sample Input 2 110060060 1e0eee 10000580000 No No One_hit_meder Waan_Buss 50000 No 1 Sample Output 2 singer oNE_HIT_WENECR:S 5ong(s) Released Mary as a Waan_fuss single to earn 940,000 . Sample Input 3 110000060100000.10000 se0000 No Yea Tho_hit_wonder Waan_fuss 50000 No 2 Mary Sample inpert a Gaateple Onarest it twanh bsat, ates. tetal carnata ter anmetates - seet, mad 10wis Eichichid the ear in Esap, ted. Sample iryut. 5 11 whe? Hfertipence fartefall ietwes tes a Sartrple 0urpur 5 tifser ta and treet, 606 . Mocls subrotien The Minatry of Vybsie_Culcha intends to impiement a syant for singers in order to offer difflouities experienced in the pandemic. The grant is to be funded from a fived pool of fandstso the firg set of singers that exhasst the funds are the only ones that are able to receive the granth, You are coesracted to write a program than modets the expected payouts. In order to reduce the possibilify of fraud however, the ministry has decided to implement a (controversial) stratery that requees entertainers to prove they are the song owniers by recording it at a Studio, even if already released. The Ministry maintains a list of Studios, and code for the Ministry and 5 tuolo clarses have abready been fully implemented. The starting code alsg indudes cal's to a templabe of a Singer elass that interacts with a Song class. Your task is to execuce eightigy tasks that complete the Singer and Song classes. The HackerRark link to the exertise is at hapsi dwww fackm thark comvcomp11614abz-7a MARKING CRITERLA (PLEASE REVEW BEFORE 5TARTING) CrMenon Markid Accessers and mMators for Singer and Song 1 Explanation of the itportance of the bostring method 1 Correct implementation of logit to sum items in the song Arraytist 1 Explanation of your logic for tryToSegisterSong0 2 NOTE :; No part of Ministry or Studio should be modified. Note that where comvenient, and allowed, you may declare private (repport) methods. LAB EXERCISES Figure 1:Simplfied UML Class Diagram for the exercise Figure 1 depicts the classes to which you will interface while completing the exercise. 1. In class 5inger, a. Complete the first constructor that atcepts name, genre, budget, as well as a reference to the Mristrylincoming arguments include a for the name, 5 for genre, and b for budgeth b. Implemene the second coestructor so that at ifstance variables are initialzed. 2. In class Sonz wribe the calculation in method getlsttarningl of dass Sonc to evaluate estimated earings. Note that whie in the real world, other methods would be used to tstimate earnings, in this simplfied model, the estimated earnings will be the lefgth of the title, multiplied by the a value extracted by the ministry using the method gethongartEstihint, the singer keeps a reference to the minatry. Vou can observe how the reference is used in mathod gectiwinableFarningsh. 3. th class Siruger, correct the method wamlsof arnings so 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 weite a mutator named secstudio(Studio studiol inwthod for the song that accepes a Studio, and sets the associated studio on the on the song to the relerenced Stutio, by, th class Singer, merhod trytofiegistersong, if the singer has a preferred studio, set studo to the preferred suidio sorigs, 5. th class Situger, methed try TofvegisterSone, update ingec to check if artist can afford studio before setting the studio on the song. 6: In eiass' Singer, method tryToficegisterSong, update iogic to allow ministry to suggent a studio by calling the mothod getBesthwallablestudio(int budget, Studio preferved) from Ministry which rebarns a suggested studio. If the method returns a studin freturned value is not rulli then set the studio for the song to the returned stadio if the singer is able to affoed it. You tan then check if the song has been connected with a shudio, and If it is, add the sang se the list of registered sanes. 7. In class Singer, method tryToAegisterSong, ersure girver's budget is reducted by the cost of the studio. 8. in chass Singer, method vyTopegintersong, cal the Studios fesprve method whan adding a song to the list of registered sangs. Also, theck to see in a stutio is avalable tusing the ishrafabled method in the studio class) before assigning the song to the studio. Input Farmat Template code handles inputs Constraints Sample Buatgut 7 tain and heter int ititer wighsigeet obutid itiotlle der toghatis froe the avatiabte fare bodenteet stiveling ingete mubte tiriar secFr+ lam(a) tur in ing 60. Heleared Aebsebger as a buta shingle te tats blecpbot. blinuff Sonation int geaviabte. siterer THARY Bussuct? pritathy Diels aet matil ald phasef ereil shattis atek. Irtertetinaest. whafr Enozha iagt atastable. Praruadid areto nec metticaten. phostajta durels wef meth halai seruen. fotel carable fer hurer a St, tha peat Stess - eupribettar tig tart. giath litelti beinhed tyosed post STwis surwert.l Stwes 20+7 therted STNEF PaBNu+1. triana shruer 1 . srivalle string napents o petre: pricela int thedgoti ar loble stadio rasstwalo artiote Arraytistesang sougs, registenedSongs? grtesce ministry etaistryi grieare int crantvalue: grlaced striet idrantitensagea arifote foin itas aituset, bentwe ne krrapliet+ Sencill: regivteriesengu naw Arrapltati soong D : Eratuensise n in th5 a fav5tudentinith iettepoly n ainttocoety I hoolan =ittapply y I thex. farstudis atilatry-matsturio(fav3z. guothe minsisy getalnstrigt) rthyH wintstry; aidist hableas appiyingCli ratarn withaply; ratern \{fastualedwwith aidlic boolienc candifordistictis studts] retarn stwelha-getCodach on butget: gublite int eeticariYelien (1) rutuen grantialsel qublic int mavontateradsaugai? i Int-mun in ift Phir fienc rectosc: hegisteredfange) wenoregseng-gteCta4siteletionangs (t) rttyen isant Int. aue + Sp foCade ta inilinant. tha hare of retarn sumy abite 14 hiy gethanti i. retarn furef 1 aublic and tur Tategiatarsang (Sony angy if (faskineliaterith) ist if LIfaristudio, Sthisitable (1) tlie 3 Syaten-out-p (nthe(nte) ahal is wial abdangiterved tithali anbge_add (neet borgltitio, eetron this b)t pubtic arraplistesene" aetsaresid return enessi ablye wad molyterbrantis i mblic strieg tostrinelH Ferine serstil 3f (eratervaluese) elve - class foutie t. arlube twing nane; gerivale int mitelleel arivele int nosi, reipertion: this, cask i cost: titi-recoration : veceratine: 1 acolye serisa antarotor Felurn nam; geable in enfrentiand pible matron isavatiobled Fetarn trotike on recaritivel getie wid rearoeli) frontion reveconditien; poble at beckesen ? meturn colt; ). 1 firmetime latin -4lan Ministry i. arinate statiol] itudies; arivese int mintrantival: arivise int sengrartase, tesesetucher ortilice tesiess suckers tedwes: irivite arraveistositiegery stingersi this_oi whandyal = e iviraviealiz this-testlefin tatt t besplie1tikation This-megessthitution o. ninectiotution: sthigers o tee tor metosossingeribi *eturk atudiea[te]? 3eb14. iet getlergfarciatch i r+Carf Dosurtest: 1 owaph bettiel14isits arbilc int getaincieimale (i) return mtipclataknif, asblic strime aedecesierantisinger singeri i ini graineititi aimpera auaf inger is 11 (etingol o mindramivel. (intingral o cravtilont] anctsontionsatticient thise Erantwal * styost? stingers, forfacti (C tinseri)-31 zoblic tot dowhstingerti. necuie stnatesistiatib 1 Studie retstadiontarsterieq int feunder +ir if (shasectiluttios) of Il faared 1t if farand? fianidiveder rerinuste ini hudesttols. elte is 11:21 www.hackerrank.com (1)) * gabtic cliasi Dr iuter Template cade handles inputs Constraints Output Format as defined Sample Input 0 11000000019000020000500000 No No Sample Output 0 Sample Input 1 11 1006tede 100600 20ted 500000 No No Tron_batleen Waan_lluss 59000 Mo 1 Sample Output 1 IRON_BALLOON[Studio one] It Sample Input 2 110060060 1e0eee 10000580000 No No One_hit_meder Waan_Buss 50000 No 1 Sample Output 2 singer oNE_HIT_WENECR:S 5ong(s) Released Mary as a Waan_fuss single to earn 940,000 . Sample Input 3 110000060100000.10000 se0000 No Yea Tho_hit_wonder Waan_fuss 50000 No 2 Mary Sample inpert a Gaateple Onarest it twanh bsat, ates. tetal carnata ter anmetates - seet, mad 10wis Eichichid the ear in Esap, ted. Sample iryut. 5 11 whe? Hfertipence fartefall ietwes tes a Sartrple 0urpur 5 tifser ta and treet, 606 . Mocls subrotien The Minatry of Vybsie_Culcha intends to impiement a syant for singers in order to offer difflouities experienced in the pandemic. The grant is to be funded from a fived pool of fandstso the firg set of singers that exhasst the funds are the only ones that are able to receive the granth, You are coesracted to write a program than modets the expected payouts. In order to reduce the possibilify of fraud however, the ministry has decided to implement a (controversial) stratery that requees entertainers to prove they are the song owniers by recording it at a Studio, even if already released. The Ministry maintains a list of Studios, and code for the Ministry and 5 tuolo clarses have abready been fully implemented. The starting code alsg indudes cal's to a templabe of a Singer elass that interacts with a Song class. Your task is to execuce eightigy tasks that complete the Singer and Song classes. The HackerRark link to the exertise is at hapsi dwww fackm thark comvcomp11614abz-7a MARKING CRITERLA (PLEASE REVEW BEFORE 5TARTING) CrMenon Markid Accessers and mMators for Singer and Song 1 Explanation of the itportance of the bostring method 1 Correct implementation of logit to sum items in the song Arraytist 1 Explanation of your logic for tryToSegisterSong0 2 NOTE :; No part of Ministry or Studio should be modified. Note that where comvenient, and allowed, you may declare private (repport) methods. LAB EXERCISES Figure 1:Simplfied UML Class Diagram for the exercise Figure 1 depicts the classes to which you will interface while completing the exercise. 1. In class 5inger, a. Complete the first constructor that atcepts name, genre, budget, as well as a reference to the Mristrylincoming arguments include a for the name, 5 for genre, and b for budgeth b. Implemene the second coestructor so that at ifstance variables are initialzed. 2. In class Sonz wribe the calculation in method getlsttarningl of dass Sonc to evaluate estimated earings. Note that whie in the real world, other methods would be used to tstimate earnings, in this simplfied model, the estimated earnings will be the lefgth of the title, multiplied by the a value extracted by the ministry using the method gethongartEstihint, the singer keeps a reference to the minatry. Vou can observe how the reference is used in mathod gectiwinableFarningsh. 3. th class Siruger, correct the method wamlsof arnings so 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 weite a mutator named secstudio(Studio studiol inwthod for the song that accepes a Studio, and sets the associated studio on the on the song to the relerenced Stutio, by, th class Singer, merhod trytofiegistersong, if the singer has a preferred studio, set studo to the preferred suidio sorigs, 5. th class Situger, methed try TofvegisterSone, update ingec to check if artist can afford studio before setting the studio on the song. 6: In eiass' Singer, method tryToficegisterSong, update iogic to allow ministry to suggent a studio by calling the mothod getBesthwallablestudio(int budget, Studio preferved) from Ministry which rebarns a suggested studio. If the method returns a studin freturned value is not rulli then set the studio for the song to the returned stadio if the singer is able to affoed it. You tan then check if the song has been connected with a shudio, and If it is, add the sang se the list of registered sanes. 7. In class Singer, method tryToAegisterSong, ersure girver's budget is reducted by the cost of the studio. 8. in chass Singer, method vyTopegintersong, cal the Studios fesprve method whan adding a song to the list of registered sangs. Also, theck to see in a stutio is avalable tusing the ishrafabled method in the studio class) before assigning the song to the studio. Input Farmat Template code handles inputs Constraints Sample Buatgut 7 tain and heter int ititer wighsigeet obutid itiotlle der toghatis froe the avatiabte fare bodenteet stiveling ingete mubte tiriar secFr+ lam(a) tur in ing 60. Heleared Aebsebger as a buta shingle te tats blecpbot. blinuff Sonation int geaviabte. siterer THARY Bussuct? pritathy Diels aet matil ald phasef ereil shattis atek. Irtertetinaest. whafr Enozha iagt atastable. Praruadid areto nec metticaten. phostajta durels wef meth halai seruen. fotel carable fer hurer a St, tha peat Stess - eupribettar tig tart. giath litelti beinhed tyosed post STwis surwert.l Stwes 20+7 therted STNEF PaBNu+1. triana shruer 1 . srivalle string napents o petre: pricela int thedgoti ar loble stadio rasstwalo artiote Arraytistesang sougs, registenedSongs? grtesce ministry etaistryi grieare int crantvalue: grlaced striet idrantitensagea arifote foin itas aituset, bentwe ne krrapliet+ Sencill: regivteriesengu naw Arrapltati soong D : Eratuensise n in th5 a fav5tudentinith iettepoly n ainttocoety I hoolan =ittapply y I thex. farstudis atilatry-matsturio(fav3z. guothe minsisy getalnstrigt) rthyH wintstry; aidist hableas appiyingCli ratarn withaply; ratern \{fastualedwwith aidlic boolienc candifordistictis studts] retarn stwelha-getCodach on butget: gublite int eeticariYelien (1) rutuen grantialsel qublic int mavontateradsaugai? i Int-mun in ift Phir fienc rectosc: hegisteredfange) wenoregseng-gteCta4siteletionangs (t) rttyen isant Int. aue + Sp foCade ta inilinant. tha hare of retarn sumy abite 14 hiy gethanti i. retarn furef 1 aublic and tur Tategiatarsang (Sony angy if (faskineliaterith) ist if LIfaristudio, Sthisitable (1) tlie 3 Syaten-out-p (nthe(nte) ahal is wial abdangiterved tithali anbge_add (neet borgltitio, eetron this b)t pubtic arraplistesene" aetsaresid return enessi ablye wad molyterbrantis i mblic strieg tostrinelH Ferine serstil 3f (eratervaluese) elve - class foutie t. arlube twing nane; gerivale int mitelleel arivele int nosi, reipertion: this, cask i cost: titi-recoration : veceratine: 1 acolye serisa antarotor Felurn nam; geable in enfrentiand pible matron isavatiobled Fetarn trotike on recaritivel getie wid rearoeli) frontion reveconditien; poble at beckesen ? meturn colt; ). 1 firmetime latin -4lan Ministry i. arinate statiol] itudies; arivese int mintrantival: arivise int sengrartase, tesesetucher ortilice tesiess suckers tedwes: irivite arraveistositiegery stingersi this_oi whandyal = e iviraviealiz this-testlefin tatt t besplie1tikation This-megessthitution o. ninectiotution: sthigers o tee tor metosossingeribi *eturk atudiea[te]? 3eb14. iet getlergfarciatch i r+Carf Dosurtest: 1 owaph bettiel14isits arbilc int getaincieimale (i) return mtipclataknif, asblic strime aedecesierantisinger singeri i ini graineititi aimpera auaf inger is 11 (etingol o mindramivel. (intingral o cravtilont] anctsontionsatticient thise Erantwal * styost? stingers, forfacti (C tinseri)-31 zoblic tot dowhstingerti. necuie stnatesistiatib 1 Studie retstadiontarsterieq int feunder +ir if (shasectiluttios) of Il faared 1t if farand? fianidiveder rerinuste ini hudesttols. elte is 11:21 www.hackerrank.com (1)) * gabtic cliasi Dr iuter

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: 3

blur-text-image

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

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

Please provide explanation and formulas

Answered: 1 week ago