forked from tpapendieck/ciip-examples
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
352 B
17 lines
352 B
package de.edu.hsfulda.ciip.tdd;
|
|
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
|
|
public class BownlingCalculator {
|
|
|
|
public int evaluate(String listOfThrows) {
|
|
Matcher matcher = Pattern.compile("\\d").matcher(listOfThrows);
|
|
int sum =0;
|
|
while (matcher.find()) {
|
|
sum+=Integer.parseInt(matcher.group());
|
|
}
|
|
return sum;
|
|
}
|
|
|
|
}
|