Browse Source

quick and dirty implementation, mostly generated by IDE

master
Thomas Papendieck 6 years ago
parent
commit
a2dcf84c49
  1. 11
      TDD-pure-function/src/main/java/de/edu/hsfulda/ciip/tdd/BownlingCalculator.java

11
TDD-pure-function/src/main/java/de/edu/hsfulda/ciip/tdd/BownlingCalculator.java

@ -1,10 +1,17 @@
package de.edu.hsfulda.ciip.tdd; package de.edu.hsfulda.ciip.tdd;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class BownlingCalculator { public class BownlingCalculator {
public int evaluate(String listOfThrows) { public int evaluate(String listOfThrows) {
// TODO Auto-generated method stub
return 0;
Matcher matcher = Pattern.compile("\\d").matcher(listOfThrows);
int sum =0;
while (matcher.find()) {
sum+=Integer.parseInt(matcher.group());
}
return sum;
} }
} }
Loading…
Cancel
Save