NetBeans IDE不断发出错误,说它无法找到符号IO。由于“IO”被视为符号,因此无法对IO执行任何输入或输出操作。无法弄清楚为什么会这样。
这是我试图运行的非常简单的程序: -
public class CourseGrade
{
public static void main(String[] args)
{
int examWeight = 70; // Percentage weight given to examination
int labWeight = 20; // Percentage weight given to lab work
int hwWeight = 10; // Percentage weight given to homework
assignment
double examScore; // Examination score obtained by student
double labScore; // Lab score obtained by student
double hwScore; // Homework score obtained by student
double finalGrade; // Final grade obtained by student
// Ask student to input scores for exam, lab and nomework
IO.output("Enter your exam grade: ");
examScore = IO.inputDouble( );
IO.output("Enter your lab grade: ");
labScore = IO.inputDouble( );
IO.output("Enter your homework grade: ");
hwScore = IO.inputDouble( );
// Computer final grade as the weighted sum of exam, lab and
homework scores
examScore = examScore * (examWeight / 100.0);
labScore = labScore * (labWeight / 100.0);
hwScore = hwScore * (hwWeight / 100.0);
finalGrade = examScore + labScore + hwScore;
// Output the final grade
IO.outputln("Your final grade is " + finalGrade);
}
}
这是我得到的错误: -
错误:找不到符号
IO.output(“输入考试分数: - \ n”);
符号:变量IO
location:class CourseGrade
我为每个使用过的IO获得了此输出。 造成这种情况的原因是什么?