E
public static void calcScores()
{
int[] scores=new int[]{59,99,65,75,88,90,91,77,82,65,86,93};//分数
int ynum=0,lnum=0,znum=0,jnum=0,bnum=0;
for(int i=0;i<scores.length;++i)
{
if(scores[i]>100)
{
System.out.println("数据有误");
return;
}
if(scores[i]<0)
{
System.out.println("数据有误");
return;
}
switch(scores[i]/10)
{
case 10:
case 9:
++ynum;
break;
case 8:
++lnum;
break;
case 7:
++znum;
break;
case 6:
++jnum;
break;
default:
++bnum;
break;
}
}
System.out.println("成绩优秀同学数目是: "+ynum);
System.out.println("成绩良同学数目是: "+lnum);
System.out.println("成绩中同学数目是: "+znum);
System.out.println("成绩及格同学数目是: "+jnum);
System.out.println("成绩不及格同学数目是: "+bnum);
}