File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Not compiling right? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Not compiling right?" Watch "Not compiling right?" New topic
Author

Not compiling right?

mike hew
Greenhorn

Joined: Oct 26, 2006
Posts: 27
this is three programs into one program.

Just need a push in the right direction, thank you.

Not looking for someone todo my homework, just point me, I gotten down from over 100 errors to these.

see the programs attached as reply's!


errors:
-Called Compiler C:\PROGRA~1\Java\JDK15~1.0_0\bin\javac.exe-
-Target File: D:\CSIS12~1\7\solution\CheckingAccount.java-

-Finished-


errors:
-Called Compiler C:\PROGRA~1\Java\JDK15~1.0_0\bin\javac.exe-
-Target File: D:\CSIS12~1\7\solution\CheckingAccountPlus.java-
D:\CSIS12~1\7\solution\CheckingAccountPlus.java:43: return outside method
return actualWithdrawal;
^
D:\CSIS12~1\7\solution\CheckingAccountPlus.java:50: return outside method
return creditCardAdvance;
^
D:\CSIS12~1\7\solution\CheckingAccountPlus.java:57: return outside method
return sumOfCreditCardAdvances;
^
3 errors

-Finished-

error's:

-Called Compiler C:\PROGRA~1\Java\JDK15~1.0_0\bin\javac.exe-
-Target File: D:\CSIS12~1\7\solution\CheckingAccountTest.java-
D:\CSIS12~1\7\solution\CheckingAccountTest.java:58: cannot find symbol
symbol : variable CheckingAccount
location: class CheckingAccountTest
if(myFields[indexForAccountType].equals(CheckingAccount).getAccountType() ){
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:61: currentAccount is already defined in main(java.lang.String[])
Object currentAccount;
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:62: cannot find symbol
symbol : method handleAccount(CheckingAccount,MyCsvFile,java.lang.String[])
location: class CheckingAccountTest
handleAccount (currentAccount, myFile, myFields);
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:71: cannot find symbol
symbol : constructor CheckingAccountPlus(java.lang.String,java.lang.String,java.lang.String,double)
location: class CheckingAccountPlus
CheckingAccountPlus currentAccount = new CheckingAccountPlus(myFields[indexForAccountId],
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:73: currentAccount is already defined in main(java.lang.String[])
Object currentAccount;
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:74: cannot find symbol
symbol : method handleAccount(CheckingAccountPlus,MyCsvFile,java.lang.String[])
location: class CheckingAccountTest
handleAccount (currentAccount, myFile, myFields);
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:128: myFields is already defined in handleAccount(CheckingAccount,MyCsvFile,java.lang.String)
String myFields[] = this.myFile.getCsvRecordFileArray();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:128: cannot find symbol
symbol : variable myFile
location: class CheckingAccountTest
String myFields[] = this.myFile.getCsvRecordFileArray();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:134: getAccountId(java.lang.String) in CheckingAccount cannot be applied to ()
currentAccount.getAccountId().equals (myFields[indexForAccountId]);
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:149: cannot find symbol
symbol : variable myFile
location: class CheckingAccountTest
this.myFile.readARecord();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:152: myFields is already defined in handleAccount(CheckingAccount,MyCsvFile,java.lang.String)
String myFields[] = this.myFile.getCsvRecordFieldArray();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:152: cannot find symbol
symbol : variable myFile
location: class CheckingAccountTest
String myFields[] = this.myFile.getCsvRecordFieldArray();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:171: cannot find symbol
symbol : variable currentAcccount
location: class CheckingAccountTest
sumOfBeginningBalances = currentAcccount.getBalance;
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:177: cannot find symbol
symbol : variable myFile
location: class CheckingAccountTest
this.myFile.readARecord();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:182: myFields is already defined in handleAccount(CheckingAccountPlus,MyCsvFile,java.lang.String,int,int)
String myFields[] = this.myFile.getCsvRecordFieldArray();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:182: cannot find symbol
symbol : variable myFile
location: class CheckingAccountTest
String myFields[] = this.myFile.getCsvRecordFieldArray();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:203: cannot find symbol
symbol : variable myFile
location: class CheckingAccountTest
this.myFile.readARecord();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:208: myFields is already defined in handleAccount(CheckingAccountPlus,MyCsvFile,java.lang.String,int,int)
String myFields[] = this.myFile.getCsvRecordFieldArray();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:208: cannot find symbol
symbol : variable myFile
location: class CheckingAccountTest
String myFields[] = this.myFile.getCsvRecordFieldArray();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:213: cannot find symbol
symbol : variable currentAcccount
location: class CheckingAccountTest
sumOfEndingBalances = currentAcccount.getBalance();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:227: cannot find symbol
symbol : variable amount
location: class CheckingAccountTest
sumOfDeposits = amount;
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:230: cannot find symbol
symbol : variable amount
location: class CheckingAccountTest
currentAccount.makeDeposit(amount);
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:233: cannot find symbol
symbol : variable amount
location: class CheckingAccountTest
System.out.printf("$%.2f",amount);
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:246: cannot find symbol
symbol : variable currentAccount
location: class CheckingAccountTest
this.currentAccount.makeDeposit(amount);
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:260: cannot find symbol
symbol : variable amount
location: class CheckingAccountTest
if(currentAccount.makeWithdrawal(amount)==true){
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:263: cannot find symbol
symbol : variable amount
location: class CheckingAccountTest
sumOfWithdrawals = sumOfWithdrawals + amount;
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:263: operator + cannot be applied to double,amount
sumOfWithdrawals = sumOfWithdrawals + amount;
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:263: incompatible types
found : <nulltype>
required: double
sumOfWithdrawals = sumOfWithdrawals + amount;
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:266: cannot find symbol
symbol : variable amount
location: class CheckingAccountTest
System.out.printf("$,%.2f",amount);
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:275: cannot find symbol
symbol : variable getOvedraftFee
location: class CheckingAccount
double overdraftFee = currentAccount.getOvedraftFee;
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:281: cannot find symbol
symbol : variable amount
location: class CheckingAccountTest
amount = amount + sumOfOverdrafts;
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:281: cannot find symbol
symbol : variable amount
location: class CheckingAccountTest
amount = amount + sumOfOverdrafts;
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:284: cannot find symbol
symbol : variable amount
location: class CheckingAccountTest
System.out.printf("$%.2f $%.2f",overdraftFee, amount);
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:300: unexpected type
required: variable
found : value
if(currentAccount.makeWithdrawal(amount) = true){
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:315: cannot find symbol
symbol : method getActualWithdrawal()
location: class CheckingAccountPlus
sumOfWithdrawals = currentAccount.getActualWithdrawal();
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:316: cannot find symbol
symbol : method getActualWithdrawal()
location: class CheckingAccountPlus
System.out.printf(currentAccount.getActualWithdrawal(),creditCardAdvance);
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:331: getAccountId(java.lang.String) in CheckingAccount cannot be applied to ()
System.out.printf(" ", currentAccount, currentAccount.getAccountId(),
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:332: getAccountType(java.lang.String) in CheckingAccount cannot be applied to ()
currentAccount.getAccountType(), currentAccount.getBalance());
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:361: getAccountId(java.lang.String) in CheckingAccount cannot be applied to ()
System.out.printf("Account Totals", currentAccount.getAccountId(),currentAccount.getAccountType(),
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:361: getAccountType(java.lang.String) in CheckingAccount cannot be applied to ()
System.out.printf("Account Totals", currentAccount.getAccountId(),currentAccount.getAccountType(),
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:362: getBeginningBalance(double) in CheckingAccount cannot be applied to ()
currentAccount.getBeginningBalance(), currentAccount.getDeposits(), currentAccount.getWithdrawals(),
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:362: getDeposits(double) in CheckingAccount cannot be applied to ()
currentAccount.getBeginningBalance(), currentAccount.getDeposits(), currentAccount.getWithdrawals(),
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:362: getWithdrawals(double) in CheckingAccount cannot be applied to ()
currentAccount.getBeginningBalance(), currentAccount.getDeposits(), currentAccount.getWithdrawals(),
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:363: getFees(double) in CheckingAccount cannot be applied to ()
currentAccount.getFees(), currentAccount.getBalance(), currentAccount.getOverdrafts(), " *");
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:363: getOverdrafts(double) in CheckingAccount cannot be applied to ()
currentAccount.getFees(), currentAccount.getBalance(), currentAccount.getOverdrafts(), " *");
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:378: non-static method getAccountType() cannot be referenced from a static context
System.out.printf("Account Totals", CheckingAccountPlus.getAccountType(), CheckingAccountPlus.getAccountType(),
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:378: non-static method getAccountType() cannot be referenced from a static context
System.out.printf("Account Totals", CheckingAccountPlus.getAccountType(), CheckingAccountPlus.getAccountType(),
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:379: cannot find symbol
symbol : method getBeginningBalance()
location: class java.lang.Object
((Object) currentAccount).getBeginningBalance(), ((Object) currentAccount).getDeposits(), currentAccount.getWithdrawals(),
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:379: cannot find symbol
symbol : method getDeposits()
location: class java.lang.Object
((Object) currentAccount).getBeginningBalance(), ((Object) currentAccount).getDeposits(), currentAccount.getWithdrawals(),
^
D:\CSIS12~1\7\solution\CheckingAccountTest.java:380: cannot find symbol
symbol : method getSumOfCreditCardAdvances()
location: class java.lang.Object
currentAccount.getBalance(), ((Object) currentAccount).getSumOfCreditCardAdvances(), " *");
^
.\CheckingAccountPlus.java:43: return outside method
return actualWithdrawal;
^
.\CheckingAccountPlus.java:50: return outside method
return creditCardAdvance;
^
.\CheckingAccountPlus.java:57: return outside method
return sumOfCreditCardAdvances;
^
53 errors

-Finished-
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by mike hew:
...I gotten down from over 100 errors to these...

Uh... Congratulations?

Okay, here are 3 tips that will help you immensely.

Tip one: Don't wait until you've written 265,891 lines of code before compiling. Write a few lines of code, then compile. If you have errors, then you know exactly where they are. Fix them before writing any more code and digging a deeper hole for yourself.

Tip two: If you aren't already using one, get a text editor that displays line numbers. (Some free options are TextWrangler for Mac, and Crimson Editor for Windows.)

Tip three: The compiler is actually pretty good about telling you what the problem is (and the line number it occurs on). Now that you have dug a hole for yourself (see tip 1), you basically need "grab the bull by the horns" and take these one at a time...

"cannot find symbol" means the compiler doesn't recognize some identifier you're using -- typically because it's declared out of scope and/or misspelled. (Remember, Java is case-sensitive.)

"is already defined in" means that you've tried to declare the same variable more than once within the same scope. (The variable name should be preceded by its type only when it's declared. After that, just use the variable name. If you precede it with its type again, the compiler will think you're trying to declare another one with the same name.)

"someMethod(args) in SomeClass cannot be applied to someMethod(different args)" basically means your argument types don't match.

"cannot be referenced from a static context" means you're trying to access a non-static (instance) member from a static context (usually a static method body). You need to either make the static member non-static, or introduce a reference into the static context (that is, instead of just calling myInstanceMethod(); call it with myInstanceReference.myInstanceMethod(); )

"return outside method" means you have a return statement outside a method body.

See what you can do with these. If you get stuck on a particular error, let us know.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not compiling right?
 
Similar Threads
Exception in thread
might not have been initialized
Exeception in thread
cannot find symbol
Output errors in main