• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Help with overriding methods

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic