stabw() Methode ergänzt

Anastasia Kisner 2024-01-07 17:02:40 +01:00
parent a0117ae961
commit c980006f02
1 changed files with 14 additions and 1 deletions

View File

@ -231,9 +231,22 @@ public class Spreadsheet {
* @return The standard deviation calculated. * @return The standard deviation calculated.
*/ */
private long stabw(String startCellName, String endCellName) { 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);
} }
/** /**