forked from IF-LK-2020/arrays2
rowSum() finished
This commit is contained in:
parent
444859323c
commit
35bc925ad8
11
Arrays.java
11
Arrays.java
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue