Hello this assignment is from last week that you helped me with. This is the feedback my professor provided me. Can you please first incorporate the changes recommended from my professor’s feedback? After the changes are made can you then Introduce Polymorphism where it’s appropriate. Thank you!!
Please indicate public, protected, default or private access modifiers for each of the member variables and methods.
You already have the 'name' attribute in Animal that is accessible from all of its descendants. You should not have it again in Bird, Mammal, and Reptile classes.
Regarding constructors, you have to think from the business (or requirements) perspective if you can create an entry for an animal without a name and without a birthdate. For instance, someone brings a lion to you. Can you register it in your system without a name and without knowing when it was born? Would the system, without knowing this information work properly? In our case, no, because it would not know how to compute life expectancy.
So, you should not have default constructors for Hawk, Eagle, etc. and you should have birthdate included in the non-default constructor.
Next, the way you have shown Animal, Bird, Mammal, Reptile constructors, it means you can instantiate them as these objects. Someone brings a creature and tells you that it is an animal, if you create a record for it, would our system work properly? No, because we can only compute life expectancy for Hawk, Eagle, etc. Additionally, this is beyond the requirements and we should not provide a solution that the requirements do not require. For these classes you should have the constructors as protected and for Hawk, Eagle, etc. you should have them as public. This would ensure that base classes cannot be instantiated and concrete class can be instantiated
Please find attached... View the full answer