Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
java, calculate standard deviation?
here's my method:
private double calculateStandardDeviation(){
double mean = calculateMean();
double totalOfSquaredDifferences = 0;
for(Employee employee: employeeList){
totalOfSquaredDifferences += Math.pow(mean - (employee.getHoursWorked() * employee.getRate()), 2);
}
double variance = totalOfSquaredDifferences / employeeList.size();
return Math.sqrt(variance);
}
but im getting the wrong answer and can't spot a logic error
hep!
thanks!
1 Answer
- 7 years agoFavorite Answer
Did you test each variable at each iteration using your debugger? If you use Eclipse, you can set points to break in running your code and you can check the values of the variables at different times of execution.
http://www.vogella.com/tutorials/EclipseDebugging/...
^tutorial for build in debugger
Lemme know if you still need more help
Send me all your code, i can debug for you too