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
364 B

  1. package de.edu.hsfulda.ciip.tdd;
  2. import java.util.regex.Matcher;
  3. import java.util.regex.Pattern;
  4. public class BownlingCalculator {
  5. public int evaluate(String listOfThrows) {
  6. int sum =0;
  7. Matcher singleDigit = Pattern.compile("\\d").matcher(listOfThrows);
  8. while (singleDigit.find()) {
  9. sum+=Integer.parseInt(singleDigit.group());
  10. }
  11. return sum;
  12. }
  13. }