public class Average
    private double [] Score;
    int index;

    public Average(double [] s)
        Score = new double[s.length];

        for(index=0; index<s.length; index++)

            if(Score[index]>100 && Score[index]<0)


    public double getAverage()
        double total=0.0;
        double average = 0.0;
        for(double value: Score)
         average= Score.length/total;
         return average;


the actual assingment is to write an IllegalArgumentException method inoder to prevent the program from accepting negative or score grater than 100

Okay? And what have tried?

by try catch block not working

In your class the "s" input is the one that has the values not the Score. I mean it is the "s" that you pass as parameter, then you put values from s to Score. Why on earth are you checking the values of Score if you put the values "s" in it after the checking?