From 7a2b0f6cf0ced19ce7b904b30c17140ee4fb7c69 Mon Sep 17 00:00:00 2001 From: Deathsbreed Date: Wed, 9 Apr 2014 17:00:35 -0500 Subject: [PATCH] Now calculates varience. --- src/MMMCalc.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/MMMCalc.java b/src/MMMCalc.java index f12d71e..e789baa 100644 --- a/src/MMMCalc.java +++ b/src/MMMCalc.java @@ -17,6 +17,7 @@ public class MMMCalc { private static float mode = 0; private static float range = 0; private static float stdDev = 0; + private static float varience = 0; public static void main(String[] args) { System.out.println("Welcome to MMMCalc v0.2, a simple tool for basic statistics calculations.\n" + @@ -42,6 +43,7 @@ public class MMMCalc { calcMode(); calcRange(); calcStdDev(); + calcVarience(); } else { numArray = new float[args.length]; @@ -55,6 +57,7 @@ public class MMMCalc { calcMode(); calcRange(); calcStdDev(); + calcVarience(); } } else { 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); } + + 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); + } }