We have discussed the variables and constructors of the Employee class hierarchy, now it's time to think about the methods.
Other than setters and getters, the key method is weeklyPay(). How do we allow HourlyEmployee, SalariedEmployee, and Manager class to calculate weekly wage using different formulas in the same method? This is a typical case for method overriding.
Parent-child relationship rules #4: to override a parent's public method, the method with the exact same signature must be re-defined in a subclass.
C. Try this:
Refer to the class hierarchy below. Design class Animal, Dog, Cat and Cow. Implement a method "public String say( )" in each class to allow a dog to say "Woof", a cat to say "Meow" and a cow to say "Moo". Create a Tester class to instantiate an object of each subclass and test the say() method.