|
In addition to the way you have defined the
needed constructors, you also need to define methods to determine the
sale price, such as: public double getSalePrice() { if (length > 20) salePrice = regularPrice * 0.95; else salePrice = regularPrice * 0.90; return salePrice; Then, you could determine the sale price of a Sedan, as follows: Sedan sedan1 = new Sedan (120, 25000.00, "red", 25); System.out.println ("Sedan's Sale Price:" + sedan1.getSalePrice()); Shawn Ayromloo Rafał Laczek wrote: Hi, I have some problems with MyOwnShop class with the main() method. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en -~----------~----~----~----~------~----~------~--~--- |
- [java programming] Lab1023 - Inheritance - homework Rafał Laczek
- [java programming] Re: Lab1023 - Inheritance - homewor... Shawn Ayromloo
- [java programming] Re: Lab1023 - Inheritance - homewor... bulimic
- [java programming] Lab1023 - Inheritance - homework Rafał Laczek
