2024-05-03 21:10:44 +02:00
|
|
|
package Domain;
|
|
|
|
|
|
|
|
public class Fives extends Category{
|
|
|
|
|
2024-05-06 16:03:55 +02:00
|
|
|
public Fives() {
|
2024-05-03 21:10:44 +02:00
|
|
|
super("Fives", "Score of all the fives rolled.");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean correctCategory(int[] values){
|
|
|
|
for(int i : values){
|
|
|
|
if(i == 5){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2024-05-06 15:57:22 +02:00
|
|
|
public int getScore(int[] values){
|
2024-05-03 21:10:44 +02:00
|
|
|
int score = 0;
|
2024-05-06 15:57:22 +02:00
|
|
|
for(int i : values){
|
2024-05-03 21:10:44 +02:00
|
|
|
if( i == 5 ){
|
2024-05-06 15:57:22 +02:00
|
|
|
score += 5;
|
2024-05-03 21:10:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return score;
|
|
|
|
}
|
|
|
|
}
|