Now calculates varience.

This commit is contained in:
Deathsbreed 2014-04-09 17:00:35 -05:00
parent fdc6f484ad
commit 7a2b0f6cf0

View File

@ -17,6 +17,7 @@ public class MMMCalc {
private static float mode = 0; private static float mode = 0;
private static float range = 0; private static float range = 0;
private static float stdDev = 0; private static float stdDev = 0;
private static float varience = 0;
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("Welcome to MMMCalc v0.2, a simple tool for basic statistics calculations.\n" + System.out.println("Welcome to MMMCalc v0.2, a simple tool for basic statistics calculations.\n" +
@ -42,6 +43,7 @@ public class MMMCalc {
calcMode(); calcMode();
calcRange(); calcRange();
calcStdDev(); calcStdDev();
calcVarience();
} else { } else {
numArray = new float[args.length]; numArray = new float[args.length];
@ -55,6 +57,7 @@ public class MMMCalc {
calcMode(); calcMode();
calcRange(); calcRange();
calcStdDev(); calcStdDev();
calcVarience();
} }
} else { } else {
System.out.println("You did not mention any variables. Use the -h argument for help."); System.out.println("You did not mention any variables. Use the -h argument for help.");
@ -141,4 +144,11 @@ public class MMMCalc {
System.out.println("Standard Deviation: " + stdDev); System.out.println("Standard Deviation: " + stdDev);
} }
private static void calcVarience() {
// NOTE: I'm doing it this way so I don't have to convert the variables to doubles and lose precision.
varience = stdDev * stdDev;
System.out.println("Varience: " + varience);
}
} }