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)
Score[index]=s[index];
}
}
public double getAverage()
{
double total=0.0;
double average = 0.0;
for(double value: Score)
total+=value;
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