my dog learned polymorphism*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with overriding methods" Watch "Help with overriding methods" New topic
Author

Help with overriding methods

Eric Johns
Greenhorn

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
Greenhorn

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: http://aspose.com/file-tools
 
subject: Help with overriding methods
 
Similar Threads
help with design of program newbie to java
help with methods return types
Help with Arrays
Java help
help with IF Statements on a program Newbie