Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

abstract class yet again into arrays..

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Happily living in the valley of the dried frogs with a few tiny ads.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic