|
|
@ -1,5 +1,13 @@ |
|
|
|
import java.util.regex.Matcher; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
public class BowlingGameCalculator { |
|
|
|
public int score(String playerResult) { |
|
|
|
return 0; |
|
|
|
Matcher singleDigit = Pattern.compile("\\d").matcher(playerResult); |
|
|
|
int playerScore = 0; |
|
|
|
while (singleDigit.find()) { |
|
|
|
playerScore += Integer.parseInt(singleDigit.group()); |
|
|
|
} |
|
|
|
return playerScore; |
|
|
|
} |
|
|
|
} |