Question : Count grade percentage

Help me out here.
What am I doing wrong. It has to be someting with the double I think
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
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);
		
		

	}

Answer : Count grade percentage

use doubles for arithmetic not ints


            double pass = (Acounter+Bcounter+Ccounter+Dcounter);      
            double passPercent = ((pass/(double)examPoints.length)*100.0);
Random Solutions  
 
programming4us programming4us