Part I: Classes - Encapsulation Encapsulationrefers to the combining of data and code into a single object.
Question:
Part I: Classes - Encapsulation
Encapsulationrefers to the combining of data and code into a single object.Data hidingrefers to an object's ability to hide its data from code that is outside the object. Only the object's methods may then directly access and make changes to the object's data. An object typically hides its data, but also allows outside code to access its methods.
Think of it like the pill picture. In a bottle you might have 50 or so of the same pills. Each pill is alike, and all have the same contents, but the casing around the pill prevents the medicine from falling out or anything else from 'coming in'. There are ways, however, to interact with the pill and get the contents into the capsule so that it still can be accessed.
Going back to the three drawings, you have been asked to make a software plan that would allow the developer to keep each of the plots of land separate for inventory/tracking purposes but without having to 're-create the wheel' for every plot. Some of the things you will want to consider are:
- Plot Size
- Plot Premium
- House Allotments (as you can see, the smaller squares can hold only smaller houses)
- Addresses/Location
- House Selected (to go on a plot, the same houses cannot go next to each other according to the county).
- All house building supplies for the house:
- Flooring
- Counter tops
- Color Siding, etc
For Part I:
- Write the description of how you would handle this situation.
- You can create a class diagram for the basic plot.
Part II: Classes - Inheritance
When an "is a" relationship exists between objects, it means that the specialized object has all the characteristics of the base object, plus additional characteristics that make it special/different.
Inheritance involves a superclass and a subclass. The superclass is the general/base/parent class, and the subclass/child is the specialized class.
The developer has decided that instead of coming up with a brand-new floor plan for each separate model home, they want to come up with a base home plan, so note the similarities and differences between the two main floors.
For the 2nd part, address the following questions:
- What would you include in the base home plan? (Note: The base home plan should be as generic as possible but include everything that both should have. Remember you can change sizes and some features.)
- What would you add/change in the home plan for Home 1? (Remember it would automatically inherit everything from the base home plan.)
- What would you add/change in the home plan for Home 2? (Remember it would automatically inherit everything from the base home plan.)
- Now you can create the base-class and sub-class diagrams in Visio.
Part III: Classes - Polymorphism
The term polymorphism refers to an object's ability to take different forms. It is a powerful feature of object-oriented programming. In this section, we will look at two essential ingredients of polymorphic behavior:
- The ability to define a method in a superclass, and then define a method with the same name in a subclass. When a subclass method has the same name as a superclass method, it is often said that the subclass method overrides the superclass method.
- The ability to declare a class variable of the superclass type, and then use that variable to reference objects of either the superclass or the subclass types.
The developer is looking at all the options for the houses. Review the Options drawing and note all the different bathroom options. So, if you create the base floor plan (boxed in red), you then need to determine all the options for the bathroom. (Hint: The method name may be something like bathing, etc. We are using a floor plan, and we are using a bit of creative license here with methods/variables).
For Part III, provide new responses that address the following:
- What would you now include in the base floor plan?
- What would you change for each of the various bathroom options? What 'methods' (features) would you override from the base class? (Note that here are 6 different bathroom options)
- Now create base-class and sub-class diagrams.
Part IV: Class Diagrams
Now it is time to put it all together. You have been asked by the company to put the class diagrams together starting out with the plot diagrams. Utilizing what you have already designed, put them all together for a full plan to demonstrate how you plan on developing the housing development program.
For Part IV, address how you will implement the program:
- How would you write a program to allow users to shift from working with plots to houses?
- What modules would you develop to align all the various options?
Gather all documents for all four parts and submit them as one document.
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill