public static void gradeDistibution(double[] examPoints, double[] gradeLimits) {
int Acounter = 0;
int Bcounter = 0;
int Ccounter = 0;
int Dcounter = 0;
int Ecounter = 0;
int Fcounter = 0;
int counter = 0;
for(int i = 0; i < examPoints.length; i++)
{
if(examPoints[i] <= (Math.rint(gradeLimits[0] * 100.0d)/100.0) && examPoints[i] >= (Math.rint(gradeLimits[1] * 100.0d)/100.0))
{
Acounter++;
}
else if (examPoints[i] <= (Math.rint(gradeLimits[1] * 100.0d)/100.0) && examPoints[i] >= (Math.rint(gradeLimits[2] * 100.0d)/100.0))
{
Bcounter++;
}
else if (examPoints[i] <= (Math.rint(gradeLimits[2] * 100.0d)/100.0) && examPoints[i] >= (Math.rint(gradeLimits[3] * 100.0d)/100.0))
{
Ccounter++;
}
else if (examPoints[i] <= (Math.rint(gradeLimits[3] * 100.0d)/100.0) && examPoints[i] >= (Math.rint(gradeLimits[4] * 100.0d)/100.0))
{
Dcounter++;
}
else if (examPoints[i] <= (Math.rint(gradeLimits[4] * 100.0d)/100.0))
{
Fcounter++;
}
}
//Calculations
double Apercent = ((Acounter/examPoints.length)*100);
double Bpercent = ((Bcounter/examPoints.length)*100);
double Cpercent = ((Ccounter/examPoints.length)*100);
double Dpercent = ((Dcounter/examPoints.length)*100);
double Epercent = ((Ecounter/examPoints.length)*100);
double Fpercent = ((Fcounter/examPoints.length)*100);
int pass = (Acounter+Bcounter+Ccounter+Dcounter);
double passPercent = ((pass/examPoints.length)*100);
System.out.println(Apercent);
System.out.println(Bpercent);
System.out.println(Cpercent);
System.out.println(Dpercent);
System.out.println(Epercent);
System.out.println(Fpercent);
System.out.println(pass);
System.out.println(passPercent);
}
|