Hi I'm due to do this one next, but I had a quick look ahead at the lab when your question came through to the group.
It looks to me that getSalePrice() method in Car instances would simply return the regular price. Then it can be used for demonstrating that you know about calling the matching parent Class method via the super keyword as in the case of Ford subclass instances, and also if you wish to you could demonstrate method overloading without using the super keyword for the other subclass instances of Truck and Sedan. As a matter of programming style I wouldn't mix the use of super for some classes and straight method overloading for others, but I guess the homework is set to test our knowledge of the various concepts covered in the lab so it can sometimes ask for things to be done in odd ways. Hope this helps. On 22/11/2009, at 2:08 PM, jmt0806 wrote: > For the homework on LAB 1023, the first statement says: > > "Create a super class called Car. The Car class has the following > fields and methods. > > * int speed; > * double regularPrice; > * String color; > * double getSalePrice(); " > > .... but there is no indication of how the getSalePrice() method is > supposed to modify the price. The instructions for the sub-classes are > specific in the criteria: > > * "double getSalePrice(); // If weight > 2000, 10% discount. > Otherwise, 20% discount." > * double getSalePrice(); // From the sale price computed from Car > class, subtract the manufacturerDiscount. > > Does anyone know what the criteria is for the getSalePrice() method > for the Car class, or do we just return the regularPrice without > performing any calculations? > > Thanks > > -- > 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 -- 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
