我不断收到以下错误: 找不到符号 可变找到Java错误当试图使用从一个方法作为一个项目的回报率在if语句
无法找到符号 方法的GetData(INT)
我确信我正在使这种方式比现在更困难,但我不知道如何使这项工作,以便通过数组搜索返回,可以看到和评估的if语句。
//assigns manager identification
manID = keyboard.nextInt();
//Fibonacci binary array for passwords
int[] passWArray = {00000000,00000001,00000001,00000010,00000011,00000101,00001000,00001101};
//item = find.getdata(manID);
if (getdata(manID) != -1)
{
//Do work here
dblPayRate = 10.85;
dblGrossPay = (intHours * dblPayRate) + (15.00);
dblTaxes = dblGrossPay * 0.19;
dblGrossPay -= dblTaxes;
//Print information to user
System.out.print("\n\n$" + df2.format(dblTaxes) +
" was withheld from this paycheck in taxes after working "+ intHours + " hours.\n\n");
System.out.print("The amount \"Employer Here\" owes you is $" + df2.format(dblGrossPay) + "\n");
}
else
{
// Dialog box for incorrect password
JOptionPane.showMessageDialog(null, "Invalid Entry! Contact the BOFH!");
//exits program (Note: needed for any JOptionPane programs)
System.exit(0);
}
}// end of long if statement for >50 hours
}//end of main method
public int find(int[] passWArray, int manID)
{
//search for manID in passWArray array
for (int index = 0; index < passWArray.length; index++)
if (passWArray[index] == manID)
return manID;
//-1 indicates the value was not found
return -1;
}// end of find method
您的getdata方法在哪里定义? – 2010-09-10 05:43:11
您错过了代码的开始部分,因此很难知道真正的错误,但是关于“long if if语句结束”的注释是在* not * if语句结尾的行中。那是否在谈论其他一些陈述?另外,除此之外,您是否知道passWArray中的值是八进制的,而不是二进制(或十进制)? – 2010-09-10 05:51:12
如果您更关注代码风格,那么您的代码将更易于阅读...并查找语法错误。 – 2010-09-10 05:51:39