File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Help with overriding methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with overriding methods" Watch "Help with overriding methods" New topic

Help with overriding methods

Eric Johns

Joined: Sep 13, 2003
Posts: 20
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

Joined: Aug 24, 2001
Posts: 348
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

Joined: Sep 13, 2003
Posts: 20
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
I agree. Here's the link:
subject: Help with overriding methods
It's not a secret anymore!