From bc13be8b4495e219e38ca0946c1dadb0d4599a01 Mon Sep 17 00:00:00 2001 From: devra Date: Mon, 8 Jan 2024 21:12:35 +0100 Subject: [PATCH] Produktrechnung implementiert --- Axel/resources/summe.csv | 10 ++++++++++ .../informatik/spreadsheet/Spreadsheet.java | 17 +++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 Axel/resources/summe.csv diff --git a/Axel/resources/summe.csv b/Axel/resources/summe.csv new file mode 100644 index 0000000..50d75e1 --- /dev/null +++ b/Axel/resources/summe.csv @@ -0,0 +1,10 @@ +=SUMME(C1:E2),,=1,=2,=3,,,,, +,,=4,=5,=6,,,,, +,,,,=0,,,,, +,,,,=0,,,,, +,,,,,,,,, +,,,,,,,,, +,,,,,,,,, +,,,,,,,,, +,,,,,,,,, +,,,,,,,,, diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java index 065264f..91c295e 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java @@ -155,8 +155,11 @@ public class Spreadsheet { } else if (formula.startsWith("PRODUKT(")) {// e.g. PRODUKT(A3:B9) + String[] onlyCells = formula.substring(8, formula.length() - 1).split(":"); - result = "TODO"; // TODO + if(checkIfCellExists(onlyCells[0])&&checkIfCellExists(onlyCells[1])) { + result = "" + pro(onlyCells[0], onlyCells[1]); + } } @@ -200,7 +203,7 @@ public class Spreadsheet { private long pro(String startCellName, String endCellName) { int werte[]=getValues(startCellName,endCellName); - int produkt=0; + int produkt=1; for(int i=0;i