Question
Kotlin Declare and implement a method named determineWinner. determineWinner accepts three non-negative Int parameters, storing the score of the first, second, and third player, respectively.
Kotlin
Declare and implement a method named determineWinner. determineWinner accepts three non-negative Int parameters, storing the score of the first, second, and third player, respectively. determineWinner should return 1, 2, or 3, if the first, second, or third player has won, respectively, and 0 if there is no winner. To win this particular game, a player's score must be strictly larger than the combined score of both other players! So if Player 1 scores 3, Player 2 scores 2, and Player 3 scores 1, then there is no winner, because the highest-scoring player (Player 1) has not scored more than the lower two players combined.
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