rowSum() finished

This commit is contained in:
artem.didytschuk 2020-08-31 21:20:42 +02:00
parent 444859323c
commit 35bc925ad8
1 changed files with 9 additions and 2 deletions

View File

@ -104,8 +104,15 @@ public class Arrays {
* @return Ein eindimensionales Array mit den Zeilensummen
*/
public int[] rowSum( Wuerfel[][] pArray ) {
// TODO: implementieren
return null;
int[]sum= new int[pArray.length];
for(int i=0;i<pArray.length;i++){
for(int j=0;j<pArray[i].length;j++){
if(pArray[i][j]!= null){
sum[i]+=pArray[i][j].getAugenzahl();
}
}
}
return sum;
}
/**