Första committen
This commit is contained in:
@@ -11,11 +11,9 @@ public class BowlingScoreCalculator {
|
|||||||
char roll = rolls.charAt(rollIndex);
|
char roll = rolls.charAt(rollIndex);
|
||||||
if (rollIsStrike(roll)) {
|
if (rollIsStrike(roll)) {
|
||||||
handleStrike(rolls, rollIndex);
|
handleStrike(rolls, rollIndex);
|
||||||
}
|
} else if (rollIsSpare(roll)) {
|
||||||
else if (rollIsSpare(roll)) {
|
|
||||||
handleSpare(rolls, rollIndex);
|
handleSpare(rolls, rollIndex);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
handleRegularRoll(rolls, rollIndex);
|
handleRegularRoll(rolls, rollIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,8 +24,7 @@ public class BowlingScoreCalculator {
|
|||||||
sum += getValueForRolls(rolls, i);
|
sum += getValueForRolls(rolls, i);
|
||||||
if (firstRoll == true) {
|
if (firstRoll == true) {
|
||||||
firstRoll = false;
|
firstRoll = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
countFrames++;
|
countFrames++;
|
||||||
firstRoll = true;
|
firstRoll = true;
|
||||||
}
|
}
|
||||||
@@ -65,11 +62,9 @@ public class BowlingScoreCalculator {
|
|||||||
char roll = rolls.charAt(rollIndex);
|
char roll = rolls.charAt(rollIndex);
|
||||||
if (rollIsStrike(roll)) {
|
if (rollIsStrike(roll)) {
|
||||||
return 10;
|
return 10;
|
||||||
}
|
} else if (roll == '-') {
|
||||||
else if (roll == '-') {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return Integer.parseInt(roll + "");
|
return Integer.parseInt(roll + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package session2;
|
package session2;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class BowlingScoreCalculatorTest {
|
public class BowlingScoreCalculatorTest {
|
||||||
|
|||||||
Reference in New Issue
Block a user