JavaRanch » Java Forums »
Java »
Java in General
| Author |
Program Errors un resolved
|
mike hew
Greenhorn
Joined: Oct 26, 2006
Posts: 27
|
|
Here just a pice of the program, but I'm getting the following errors, and can't seem to figure how to define them. Can someone give me an example or a clue where to look. Thanks. Errors: -Called Compiler C:\PROGRA~1\Java\JDK15~1.0_0\bin\javac.exe- -Target File: G:\9\CheckingAccountTest.java- G:\9\CheckingAccountTest.java:79: cannot find symbol symbol : variable CheckingAccount location: class CheckingAccountTest if(myFields[indexForAccountType].equals(CheckingAccount).getAccountType()){ ^ G:\9\CheckingAccountTest.java:80: cannot find symbol symbol : class currentAccount location: class CheckingAccountTest currentAccount CheckingAccount = currentAccount(myFields[indexForAccountId], myFields[indexForFirstName], ^ G:\9\CheckingAccountTest.java:80: cannot find symbol symbol : method currentAccount(java.lang.String,java.lang.String,java.lang.String,double) location: class CheckingAccountTest currentAccount CheckingAccount = currentAccount(myFields[indexForAccountId], myFields[indexForFirstName], ^ G:\9\CheckingAccountTest.java:82: cannot find symbol symbol : variable currentAccount location: class CheckingAccountTest Object.handleAccount (currentAccount, myFile, myFields); ^ G:\9\CheckingAccountTest.java:83: cannot find symbol symbol : variable currentAccount location: class CheckingAccountTest currentAccount = null; ^ G:\9\CheckingAccountTest.java:91: cannot find symbol symbol : class CheckingAccountPlus location: class CheckingAccountTest CheckingAccountPlus currentAccount = new CheckingAccountPlus(myFields[indexForAccountId], ^ G:\9\CheckingAccountTest.java:91: cannot find symbol symbol : class CheckingAccountPlus location: class CheckingAccountTest CheckingAccountPlus currentAccount = new CheckingAccountPlus(myFields[indexForAccountId], ^ 7 errors -Finished-
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
Well, the error is due to the first of these lines if(myFields[indexForAccountType].equals(CheckingAccount).getAccountType()){ currentAccount CheckingAccount = currentAccount(myFields[indexForAccountId], myFields[indexForFirstName], myFields[indexForLastName], Double.parseDouble(myFields[indexForBalance])); If "CheckingAccount" is already supposed to be a variable in the first line, then why are you declaring a variable by the same name in the second line? The error message says there's no such variable in the first line, and indeed, there isn't. If it's not supposed to be a variable, then it's just that your syntax is messed up. Personally, I can't tell what you're trying to do, and that's to a large degree because you seem to be ignoring -- or even deliberately flouting -- the very strongly established naming conventions in Java. Following them makes it much easier for experienced coders to understand your code. Basically, only class names should start with a capital letter; variables (local ones, members, parameters) should all start with a small letter. So if "checking account" is a class, it should be written "CheckingAccount". If it's a variable, it should be named "checkingAccount"
|
[Jess in Action][AskingGoodQuestions]
|
 |
mike hew
Greenhorn
Joined: Oct 26, 2006
Posts: 27
|
|
Ah I see your point, i took another look at the instructors Pseudo code, seems there is alot of those that way. Figures since this instructor is bit off anyways!! example, in our Course exericises, which are online, you can take them as much as you want, the problem is, you might answer a question right, but the program tells your wrong, you tell him, he gives you the points, but does he fix the problem, NOPE, lol.
|
 |
 |
|
|
subject: Program Errors un resolved
|
|
|
|