Standard deviation project

Write a program to input up to 100 percentage scores and output 'A', 'B', 'C', 'D' or 'F' based on the standard deviation. A is 1½ standard deviations above the mean and better, B is ½ standard deviations above to 1½ standard deviations above the mean, C is anything from ½ a standard deviation above the mean to ½ a standard deviation below, D is 1½ standard deviations below the mean to ½ a standard deviation below the mean, and F is more than 1½ standard deviations below the mean. Enter a negative grade to quit.

this is what I have so far any help would be greatly appreciated.

I am hung up trying to make a loop so that it will only calculate with positive answers and when a negative is inserted it will stop.

Re: Standard deviation project

I am hung up trying to make a loop so that it will only calculate with positive answers and when a negative is inserted it will stop.

The simple answer is that you can use an if statement to check what was entered and, if it is negative, then break out of the loop.

Notice, though, that the array will contain a whole bunch of zeros at the end. And this is no good because zero is a valid data value. So what you are going to have to do is fill these unused array slots with some negative value.

Even once you have done that array.length has nothing to do with the number of scores that were entered. Again because of the unused slots at the end. You may find yourself having to implement a findCount() method in the StandardDeviation class so that the other two methods can use this value. (There is also a straight forward way of calculating the standard deviation with "one sweep" through the data - which is how calculators do it, for instance - which you might want to investigate.)