麻烦各位JAVA达人看看我写的JAVA程序错在哪,
1个回答

首先,像private,public这些词是不可以大写的,你要全部改成小写

其次,你在定义getAverage函数的时候是代参的,结果你最后在调用的时候没有赋参数,所以肯定是错的.

最后,inputGrades函数,输入不是那么写的,要先写 Scanner in = new Scanner(System.in);

才能写你所谓的score1 = in.nextDouble();记住这个地方,next后边跟的类型,必须和你的score1的类型一致.

下边是我帮你改好的:

//

public static void main(String[] args)

{

Student student1 = new Student("Mary");

//create student2,"Mike"

Student student2 = new Student("Mike");

//input grades for Mary

System.out.println("please input the scores of the student:");

student1.inputGrades();

//print average for Mary

student1.getAverage();

student1.ptritName();

System.out.println("please input the scores of the student:");

student2.inputGrades();

student2.getAverage();

student2.ptritName();

//input grades for Mike

//print average for Mike

}

}