谁帮我看看哪里错了
import *;import java.util.*;
class ScoreLL
{
public static String[] inputScore() throws IOException
{
BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
return buf.readLine().split(" ");
}
public static void dataTransform(String input[],String name[],double test[],double regular[],int count)
{
name[count]=input[0];
regular[count]=Double.parseDouble(input[1]);
test[count]=Double.parseDouble(input[2]);
}
public static boolean isLegal(double score)
{
if ((0<=score)&&(score<=100))
{
return true;
}
else return false;
}
public static double score(double regular,double test)
{
return (regular*0.3+test*0.7);
}
public static void outputScore(String name[],double score[],char grade[])
{
System.out.println("姓名"+"\t"+"成绩"+"t"+"等级");
for (int i=0;i<name.length ;i++ )
{
System.out.printf("%s\t %.1f\t %c\n",name[i],score[i],grade[i]);
}
}
public static void main(String[] args) throws IOException
{ BufferedReader buf;
int num;
String name[];
double regular[];
double test[];
double score[];
char grade[];
System.out.print("请输入学生人数:");
buf=new BufferedReader(new InputStreamReader(System.in));
num=Integer.parseInt(buf.readLine());
System.out.println(num);
name = new String[num];
regular = new double[num];
test = new double[num];
score = new double[num];
grade = new char[num];
System.out.println("请按照姓名 考试成绩 平时成绩输入!");
for(int i=0;i<num;i++)
{
dataTransform(inputScore(),name,regular,test,i);
if(isLegal(regular[i])&& isLegal(test[i]))
{
score[i]=score(regular[i],test[i]);
}
else
System.out.println("输入有误,请重新输入");
for(int j=i+1;j<num;j++)
{
if(score[i]>score[i+1])
{
double aa[]= new double[num];
score[i]=aa[i];
score[i+1]=score[i];
aa[i]=score[i];
}
}
}
for(int i =0;i<num;i++)
{
if(score[i]>=85)
System.out.println(name[i]+"\r综合成绩为:"+score[i]+"\n所属等级为:A");
else if(75<=score[i]&&score[i]<85)
System.out.println(name[i]+"\r综合成绩为:"+score[i]+"\n所属等级为:B");
else if(65<=score[i]&&score[i]<75)
System.out.println(name[i]+"\r综合成绩为:"+score[i]+"\n所属等级为:C");
else
System.out.println(name[i]+"\r综合成绩为:"+score[i]+"\n所属等级为:D");
}
}
}
输入是这样的,这是出了什么问题?
D:\作业\java大作业>java ScoreLL
请输入学生人数:2
2
请按照姓名 考试成绩 平时成绩输入!
li 86 57
l 89 87
综合成绩为:0.0
所属等级为:D
综合成绩为:88.39999999999999
所属等级为:A
[此贴子已经被作者于2016-10-29 22:57编辑过]