Points scored

Report a typo

Look at the values resources below:

<resources>
    <string name="students_score">You scored %1$s out of %2$d</string>
    <plurals name="points">
        <item quantity="one">%d point</item>
        <item quantity="other">%d points</item>
    </plurals>
</resources>

Finish implementing the code so that the function getScore() returns a string containing the points scored by a student compared to the total of points. The points scored and total points are provided to the function as arguments. The format of the string for a student who scored 9 points out of 10 should be "You scored 9 points out of 10".

Make use of the values resources provided above.

You have access to the Resources class through resources. The getString() function is to be accessed as a method of resources

Sample Input 1:

8 10

Sample Output 1:

You scored 8 points out of 10
Write a program in Kotlin
fun getScore(pointsScored: Int, totalPoints: Int): String {
// Write your code here!

}
___

Create a free account to access the full topic