• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Compiling Errors - Help please

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to add methods getType() and getAmount()
 
Joe Grimp
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If i added these to my code would it solve the errors?

 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic