diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java index 53ccd58..8484eaa 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java @@ -231,9 +231,22 @@ public class Spreadsheet { * @return The standard deviation calculated. */ private long stabw(String startCellName, String endCellName) { + long mean = mit(startCellName, endCellName); + long counter = counterOfCellsWithValue(startCellName, endCellName); + long result = 0; + for(char col = startCellName.charAt(0); col <= endCellName.charAt(0); col++) { - return 0; + for (int row = Integer.parseInt(startCellName.substring(1)); row <= Integer.parseInt(endCellName.substring(1)); row++) { + + String value = get((row - 1), (col - 'A')); + + if(!value.isEmpty()){ + result += (long) Math.pow(Long.parseLong(value) - mean, 2); + } + } + } + return (long) Math.sqrt(result / counter); } /**