早教吧 育儿知识 作业答案 考试题库 百科 知识分享

麻烦各位JAVA达人看看我写的JAVA程序错在哪,//publicclassGrades{publicstaticvoidmain(String[]args){Studentstudent1=newStudent("Mary");//createstudent2,"Mike"Studentstudent2=newStudent("Mike");//inputgradesforMarySystem

题目详情
麻烦各位JAVA达人看看我写的JAVA程序错在哪,
//
public class Grades
{
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
}
}
感激不尽
▼优质解答
答案和解析
首先,像private,public这些词是不可以大写的,你要全部改成小写其次,你在定义getAverage函数的时候是代参的,结果你最后在调用的时候没有赋参数,所以肯定是错的.最后,inputGrades函数,输入不是那么写的,要先写 Scanner...