我在代码的最后一部分找不到我的错误。最后一部分 ( printMyProgress()
) 方法无法正常工作。
printMyProgress()
调用调用的方法,将调用和方法printStudentProgress()
返回的值作为参数传递。getMyName()
getMyTimeSoFar()
public class first {
String getMyName() {
String name = "Nat";
return name;
}
int getMyTimeSoFar() {
int time=0;
return time;
}
void printStudentProgress(String name, int time) {
String minute ="";
if (time>1)
minute = "minutes";
else minute= "minute";
print (name + " took " +time+ " "+ minute+" to reach Q7 in the Exam");
}
int printMyProgress() {
String name = "Nat";
int time=0;
printStudentProgress(name, time);
return printMyProgress();
}
}