我使用Java使用Eclipse,出现此错误:"Variable name" cannot be resolved to a variable.使用此Java程序:public class SalCal { private int hoursWorked; public SalCal(String name, int hours, double hoursRate) { nameEmployee = name; hoursWorked = hours; ratePrHour = hoursRate; } public void setHoursWorked() { hoursWorked = hours; //ERROR HERE, hours cannot be resolved to a type } public double calculateSalary() { if (hoursWorked <= 40) { totalSalary = ratePrHour * (double) hoursWorked; } if (hoursWorked > 40) { salaryAfter40 = hoursWorked - 40; totalSalary = (ratePrHour * 40) + (ratePrHour * 1.5 * salaryAfter40); } return totalSalary; }}是什么导致此错误消息?
添加回答
举报
0/150
提交
取消