diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java index eae19ed..68dc7c5 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java @@ -5,6 +5,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.Arrays; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -195,7 +196,18 @@ public class Spreadsheet { else if (formula.startsWith("STABW(")) // e.g. STABW(C6:D8) -> Standardabweichung - result = "TODO"; // TODO + if(formula.length()<13) + result = "" + standardDeviation(substringStartCell1, substringEndCell); + else if(formula.length()<14&&substringStart2.contains(":")) + result = "" + standardDeviation(substringStartCell1, substringEndCell); + else if(formula.length()<14&&!substringStart2.contains(":")) + result = "" + standardDeviation(substringStart2, substringEndCell); + else if(formula.length()<15) + result = "" + standardDeviation(substringStart2, substringEndCell); + else + result = "0"; + + else if (formula.startsWith("MIN(")) // e.g. MIN(C13:H13) -> größter Wert result = "TODO"; // TODO else if (formula.startsWith("MAX(")) // e.g. MAX(A1:A10) -> Standardabweichung @@ -265,7 +277,58 @@ public class Spreadsheet { cellNames.add(getCellName(r, c)); } catch (NumberFormatException n){} avg /= counter; - return 0; + //average + + ArrayList copyCellNames = new ArrayList<>(cellNames); + double[] frequency = new double[cellNames.size()]; + Arrays.fill(frequency,1); + ArrayList relativeFrequency = new ArrayList<>(); + double mem = 0; + + for(int i = 0; i< cellNames.size(); i++) { + for(int t = 0; t