Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compiling Errors - Help please

 
Joe Grimp
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i compile my piece of code i get the following errors -

C:\jexp>javac banktest.java
banktest.java:182: cannot find symbol
symbol : method getType()
location: class BankAccount
if(getType())
^
banktest.java:184: cannot find symbol
symbol : method getAmount()
location: class BankAccount
return currentBalance - getAmount();
^
banktest.java:190: cannot find symbol
symbol : method getType()
location: class BankAccount
if(!getType())
^
banktest.java:192: cannot find symbol
symbol : method getAmount()
location: class BankAccount
return currentBalance + getAmount();
^
banktest.java:192: operator + cannot be applied to double,getAmount
return currentBalance + getAmount();
^
banktest.java:192: incompatible types
found : <nulltype>
required: double
return currentBalance + getAmount();
^
banktest.java:207: cannot find symbol
symbol : method readDate()
location: class Transaction
list[i].readDate();
^
7 errors


Here is the code -



How can i fix these errors? Thanks.
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to add methods getType() and getAmount()
 
Joe Grimp
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i added these to my code would it solve the errors?

 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well... no, because you haven't got member variables named "type" or "amount". You've got a "currentBalance", however, which I suspect is what "amount" is intended to be. I think you need to take a step back and look at things. Where are you getting the idea to call these nonexistent methods from, anyway?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic