Help with destroyers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help with destroyers

I don't understand how to take the input parameter as an index to generate the winner. I need help with this exercise. In the TV intellectual game, 5 participants advanced to the final round, and it is time to show the winner and finish the game. The given program defines the set of finalists, takes the winner's index as input, and creates the FinalRound object. Complete the FinalRound class - write the necessary code in the constructor to take the winner's array and index as a parameter and generate the corresponding message to display the winner. Then create the destroyer to end the game and generate "Game Over". Input example two Output example Winner is Leyla Brown Game over This is my code: https://code.sololearn.com/cc20XaaiELqs/?ref=app

5th Jul 2021, 11:54 PM
Alex Narváez
Alex Narváez - avatar
3 Answers
+ 4
Console.WriteLine("Winner is " + finalists[winner]);
5th Jul 2021, 11:59 PM
visph
visph - avatar
+ 3
Haa, now I understand it better. Thank you very much for your help visph
6th Jul 2021, 12:04 AM
Alex Narváez
Alex Narváez - avatar
+ 1
also, input must be a number, not the name of the number (2 not two) and "Game over" must not have capitalized "O" (if your output example is right)
6th Jul 2021, 12:03 AM
visph
visph - avatar