Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with overriding methods

 
Eric Johns
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need some help with overridding methods. I have car class and then some children class of the car class.. here is my car class

Now what I am trying to due is in the client class I'm trying to overide the car class's getCarsuggestedRetailPrice with this new getCarSuggestedRetatilPrice in PassengerCar Class, but no matter how I do or I should say where I put the code,I am always getting the same suggested Retail price value no change which leads me to think that it's not overriding the Car class's methods or somethings not right, would anybody have any suggestions? thanks.
 
chi Lin
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the PassengerCar class there are two variables
manufacturerDiscount, dealerDiscount
Do you initialize them to a proper value ? As those two are invloved with calculation of suggestedRetailPriceor and the deafult is 0.0
 
Eric Johns
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my problem was I forgot to bring the values in for those var. thanks alot don't know how I missed that one.. thanks Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic