Candidate's votes

Report a typo

You are provided with the plurals resource below:

<plurals name="candidate_votes">
    <item quantity="one">%1$s: %2$d vote</item>
    <item quantity="other">%1$s: %2$d votes</item>
</plurals> 

The function formatCandidateVotes() below takes two arguments: name, a string that represents a candidate's name, and votes, an integer that represents the number of votes obtained by a candidate.

Use the plurals resource above to return a grammatically correct string that includes the name of a candidate and their number of votes.

You have access to the Resources instance through resources.

Sample Input 1:

Eric 12

Sample Output 1:

Eric: 12 votes
Write a program in Kotlin
fun formatCandidateVotes(name: String, votes: Int): String {
// Write your code here!

}
___

Create a free account to access the full topic