cs_domxaline
Messages postés327Date d'inscriptionjeudi 21 août 2008StatutMembreDernière intervention10 mai 2012
-
28 févr. 2012 à 14:33
cs_domxaline
Messages postés327Date d'inscriptionjeudi 21 août 2008StatutMembreDernière intervention10 mai 2012
-
28 févr. 2012 à 17:46
Bonjour,
voilà j'écris ce prg mais j'ai 2 erreur dans la main,quelqu'un peut m'aider le corriger
import java.io.*;
public class StudentMarks
{
int r1=0,r2=0,r3=0,r4=0,rn=1;
static BufferedReader br;
public StudentMarks( int num)
{
int arr[]= new int [num];
try
{
for(int i=0; i=0&& arr[j]<=40)
{
r1++;
}
else if (arr[j]>40 && arr[j]<=60)
{
r2++;
}
else if (arr[j]>60 && arr[j]<=80)
{
r3++;
}
else if (arr[j]>80 && arr [j]<=100)
{
r4++;
}
}
System.out.println("Students securing marks in the range of 0-40 are \t"+r1);
System.out.println("Students securing marks in the range of 40-60 are \t"+r2);
System.out.println("Students securing marks in the range of 60-80 are \t"+r3);
System.out.println("Students securing marks in the range of 80-100 are \t"+r4);
}
//end of try
catch(Exception exp)
{
System.out.println(exp);
}
//end catch
}
//end constructor
public static void main (String args[])
{
int sm;
try
{
br=new BufferedReader(new inputStreamReader(System.in));
System.out.println("Enter the total nb of students in the class");
int total_students=Integer.parseInt(br.readLine());
StudentMarks.sm=new StudentMarks(total_students);
}
//end of try
catch(Exception exp)
{
System.out.println(exp.getMessage());
}//end of catch
}//end main
}//end of class
}