Answered step by step
Verified Expert Solution
Question
1 Approved Answer
would like an example for this Pick any two other real world objects similar to rectangle' and box that have a hierarchical relationship. For example,
would like an example for this
Pick any two other real world objects" similar to "rectangle' and box that have a hierarchical relationship. For example, pick "car" and "race car or "mammal" and "dog." Create classes similar to the ones in the Classes Starter code. Inherit from one class to the other in similar fashion. Use a functions module as shown in the Classes Starter code for functions that act on the objects. Make sure your setters have protections in them so the object cannot be put in an invlaid state. For example, in the Classes Starter code, you cannot set height or width below zero because that makes no sense. All properties (aka attributes, aka variables) of classes must be private. This goes for all attributes in all assignments and in the professional world as well. All methods that are public should need to be public, and all others should be private. Use your own setters inside your objects (especially in the constructor). No getter should ever modify the object, getters are strictly for reading data. Have at least one example of a method override. For example in the Classes Starter code getArea() is overridden in the box class, from the rectangle class. Have at least one example of more functionality in the child class, for example in the Classes Starter code the box class has a getVolume() method that rectangle does not have, because it makes no sense for a rectangle to have volume. Keep your code and application simple. It does not need to be any more sophisticated or interesting than the Classes Starter code. This class (like all good code) conforms to the KISS methodology... Keep It Stupid Simple Make a main() that thoroughly tests your application in automated fashion (do not use user input)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started