@@ -0,0 +1,2799 @@
+package intro_to_statistics;%0A%0Aimport java.util.*;%0A%0Apublic class Warmup %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        %0A        Scanner sc = new Scanner(System.in);%0A        int arrayLength = sc.nextInt();%0A        int%5B%5D arr = new int%5BarrayLength%5D;%0A        for (int i = 0; i %3C arr.length; i++) %7B%0A            arr%5Bi%5D = sc.nextInt();%0A        %7D%0A        Arrays.sort(arr);%0A        System.out.printf(%22%25.1f%25n%22, getMean(arr));%0A        System.out.printf(%22%25.1f%25n%22, getMedian(arr));%0A        System.out.println(getMode(arr));%0A        System.out.printf(%22%25.1f%25n%22, getStandardDeviation(arr));%0A        sc.close();%0A    %7D%0A    %0A    private static double getMean(int%5B%5D arr) %7B%0A        double total = 0;%0A        for (int num : arr) %7B%0A            total += num;%0A        %7D%0A        return total / arr.length;%0A    %7D%0A    %0A    private static double getMedian(int%5B%5D arr) %7B%0A        %0A        if (arr.length %25 2 == 1) %7B%0A            return (double) arr%5Barr.length / 2%5D;%0A        %7D else %7B%0A            return (double) (arr%5Barr.length / 2%5D + arr%5B(arr.length / 2) - 1%5D) / 2.0;%0A        %7D%0A    %7D%0A    %0A    public static int getMode(int%5B%5D input) %7B%0A        int returnVal = input%5B0%5D; // stores element to be returned%0A        int repeatCount = 0; // counts the record number of repeats%0A        int prevRepCnt = 0; // temporary count for repeats%0A        int lowerValue = Integer.MAX_VALUE; // initalize it with the highest integer value - 2147483647%0A%0A        for (int i=0; i%3Cinput.length; i++) %7B // goes through each elem%0A%0A            for (int j=i; j%3Cinput.length; j++) %7B // compares to each elem after the first elem%0A%0A                if (i != j && input%5Bi%5D == input%5Bj%5D) %7B // if matching values%0A                    repeatCount++; // gets the repeat count%0A%0A                    if (repeatCount%3EprevRepCnt) %7B // a higher count of repeats than before%0A                        returnVal=input%5Bi%5D; // return that element%0A                        lowerValue = returnVal; // set the variable lowerValue to be the lower value%0A                    %7D else if ((repeatCount == prevRepCnt) && (input%5Bi%5D %3C lowerValue)) %7B%0A                        returnVal=input%5Bi%5D; // return that element%0A                        lowerValue = returnVal; // set the variable lowerValue to be the lower value%0A                    %7D%0A                    prevRepCnt = repeatCount; // Keeps the highest repeat record%0A                %7D%0A                repeatCount=0; // resets repeat Count for next comparison%0A            %7D%0A        %7D%0A        return returnVal;%0A    %7D%0A    %0A    private static double getStandardDeviation(int%5B%5D arr) %7B%0A        double mean = getMean(arr);%0A        double totalNumerator = 0;%0A        for (int num : arr) %7B%0A            double diff = num - mean;%0A            totalNumerator += diff * diff;%0A        %7D%0A        return Math.sqrt(totalNumerator / arr.length);%0A    %7D%0A%7D

Add Warmup