diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java index a458548..9274d7c 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java @@ -194,7 +194,7 @@ public class Spreadsheet { String result = ""; if (formula.startsWith("SUMME(")) // e.g. SUMME(A3:A8) - result = "" + sum(formula.substring(6, 8), formula.substring(9, 11)); // TODO adapt to cells with two digits + result = "" + sum(formula.substring(6, 8), formula.substring(9, 11)); // adapt to cells with two digits else if (formula.startsWith("PRODUKT(")) // e.g. PRODUKT(A3:B9) result = "" + pro(formula.substring(8, 10), formula.substring(11, 13)); else if (formula.startsWith("MITTELWERT(")) // e.g. MITTELWERT(A3:A5) @@ -292,15 +292,11 @@ public class Spreadsheet { int endCellRow = getRow(endCellName); int endCellCol = getCol(endCellName); - long res = 0; + long res = 1; for (int i = startCellRow; i <= endCellRow; i++) { for (int j = startCellCol; j <= endCellCol; j++) { - if (res == 0) { - res = Integer.parseInt(cells[i][j].getValue()); - } else { - res = res * (Integer.parseInt(cells[i][j].getValue())); - } + res = res * (Integer.parseInt(cells[i][j].getValue())); } } @@ -411,7 +407,7 @@ public class Spreadsheet { while (m.find()) { // m.find() must always be used before m.group() String s = m.group(); if (!s.isEmpty()) { - System.out.println(s); + //System.out.println(s); zaehler++; switch (zaehler){