• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Not compiling right?

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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-
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic