Yatzy/Domain/Yatzy_Sheet.java

41 lines
787 B
Java

package Domain;
public class Yatzy_Sheet {
private int[] tabelle = new int[15];
public Yatzy_Sheet(){
}
public void addScore(int categoryNumber, int score){
for(int i = 0; i < 14; i++){
if(i == categoryNumber){
tabelle[i] = categoryNumber;
}
}
}
//counts all the
public int getSumOne(){
int sum = 0;
for(int i = 0; i < 6; i++){
sum += tabelle[i];
}
return sum;
}
public int getSumTwo(){
int sum = 0;
for (int i = 7; i < 17; i++){
sum += tabelle[i];
}
return sum;
}
public int getSum(){
int sumOne = getSumOne();
int sumTwo = getSumTwo();
return sumOne += sumTwo;
}
}