• Post Reply Bookmark Topic Watch Topic
  • New Topic

abstract class yet again into arrays..  RSS feed

 
Bradley Jordan
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I need to create an arry of the subclass. I need to create a for loop that instanitates 5 objects of the Checking class and then a for loop that prints out the toString method and prints out the amount of interest for each object. I have three as the interstperiod.
this is what I have so far:


this complies but it is only printing the first three account numbers and account balances. Why is that. If I add the bankSavings[x].computeIntrest () to it. It can't find it.
AccountArray.java:24: cannot find symbol
symbol : method computeIntrest()
location: class Checking
System.out.println(bankSavings[x].toString()+ bankSavings[x].computeIntrest());

Please help. Maybe I need a diffent way of getting the interest earned.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jordon,

computeInterest() takes one int argument, you are making call
to it without any argument!

check the missing spelling of computeInterest() too.


Regards,
cmbhatt
 
Rahul Shilpakar
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, it's working fine with my programe. i think you called computeinterest()with out argument , give integer argument to it.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!