Hey guys I have a quick question on my hw, I have found everything needed except the "unusual scores". this is the direction given:

Determine which of the grades, if any, are "unusual" in the sense that their corresponding z-score is < -2.0 or > +2.0. A z-score is computed as:


I know what the x bar and the s is, but I am unsure of what the first x is pertaining to. Can anyone give me a few tips?

Thanks

public class hw05 {
 

    public static void main( String [] args ) {
   	
   	   int [] grades = {98, 87, 78, 100, 99, 67, 69, 50,
                 88, 100, 88, 79, 60, 75, 93, 97,
                 40, 98, 88, 62, 58, 85, 92, 93,
                 59, 98, 94, 95, 87, 47, 69, 79,
                 89, 85, 68, 75};
       int i;
    
       System.out.println("Original grades:");
       printArray(grades);
       System.out.printf("\n\nNumber of grades: %6d", grades.length);
       System.out.printf("\nMaximum grade: %9d", maxArray(grades));
       System.out.printf("\nMinimum grade: %9d", minArray(grades));
       System.out.printf("\nMean:                 %.1f", mean(grades));
       System.out.printf("\nStandard Deviation:   %.1f", stdDev(grades));
   }
   
    public static void printArray(int [] a) {
   	   for (int i = 0; i < a.length; i++ ) {
          System.out.printf("%6d", a[i]);
          if ((i + 1) % 5 == 0)
             System.out.printf("\n");
       }
    }
    
    public static int maxArray(int [] a) {
       int max = Integer.MIN_VALUE;           
       for (int i = 0; i < a.length; i++)
          if (a[i] > max)
             max = a[i];
       return max;
    }
   
    public static int minArray(int [] a) {
       int min = Integer.MAX_VALUE;           
       for (int i = 0; i < a.length; i++)
          if (a[i] < min)
             min = a[i];
       return min;
    }
    
    public static int sumGrades(int [] a) {
       int sum = 0;
       for (int i = 0; i < a.length; i++)
       	  sum += a[i];
       return sum;
    }
    
    public static double mean(int [] a) {
       return (double)sumGrades(a) / a.length;
    }
    
    public static double sumSquares(int [] a) {
    	double ss = 0.0;
    	for (int i = 0; i < a.length; i++)
    	ss += (a[i] - mean(a)) * (a[i] - mean(a));
    	return ss;
    }
    
    public static double stdDev(int [] a) {
       return Math.sqrt(sumSquares(a) / (a.length - 1));	
    } 

}

i was looking for help with the code, i can use google too, thank you for the smart reply, that always helps when a beginner is asking a question

Do you understand the equation? The x you are looking for is the input value to find out what the z-score is. First you need to create a method which computes z-score. It requires you to have mean-x and s value before hand. Then, it takes a value which is called 'x', compute, and spit out the z-score. That's all it means. The code does not have the method and I believe you need to implement it.

Member Avatar for ztini
i was looking for help with the code, i can use google too, thank you for the smart reply, that always helps when a beginner is asking a question

Jon was right on track. This is a Java forum, not a math forum.

Scores: 85, 90, 95

Z(85) = z = (85 - 90) / 3 = -1.67, within tolerance.

Scores: 85, 90, 95, 50

Z(50) = z = (50 - 80) / 4 = -7.5, outside tolerance...e.g out-liner

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.