31 lines
532 B
Java
31 lines
532 B
Java
package Domain;
|
|
|
|
public class Ones extends Category{
|
|
|
|
public Ones() {
|
|
super("Ones", "Score of all the ones rolled.");
|
|
}
|
|
|
|
@Override
|
|
public boolean correctCategory(int[] values){
|
|
for(int i : values){
|
|
if(i == 1){
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public int getScore(int[] values){
|
|
int score = 0;
|
|
for (int i : values) {
|
|
if (i == 1) {
|
|
score += 1;
|
|
}
|
|
}
|
|
return score;
|
|
}
|
|
|
|
}
|