Extended Learning Module G – Object-Oriented Technologies
Mod G-14
ASSIGNMENTS & EXERCISES (p. G.22)
1. Classes in the Classroom: Take a look around your classroom and on a piece of paper list
twenty different objects located in the classroom. Objects might include desks, chairs,
lights, students, etc. If you were going to build a classroom inventory tracking system how
many classes would you need to define in order to track all of the objects? What would be
the name of each class? What information and procedures would be stored in each class?
On a separate sheet of paper, draw a class diagram displaying all of the classes along with
the different types of information and procedures they contain. Be sure to try to take
advantage of inheritance. Take both sheets of paper and match each object to an
appropriate class. If all of the objects match to a class, you created a successful system.
Chances are every student’s class diagram is probably going to be different because there is
no right or wrong answer to this exercise, so be creative and have fun defining your classes.
Be sure to look at some of the other student’s diagrams to see how they defined their
classes.
DISCUSSION
• This exercise is a great introduction to object-oriented.
2. Trees-R-Us: Congratulations, you’ve been hired to build an Inventory Tracking system for
the Trees-R-Us landscaping company. Trees-R-Us is excited about the use of inheritance in
object-oriented systems and wants to see how you’re going to use it in the system. Trees-R-
Us has already defined the Tree, Grass, Flowers, Fence, Equipment, and Plant classes. Your
job is to define all of the information and procedures for each class and the inheritance
structure of the classes, or the superclass and subclass relationships. Please provide a class
diagram that displays all of the classes for the Tree-R-Us Inventory Tracking system and be
sure to include inheritance. Again, there is no right or wrong answer for this exercise so be
creative and look at some of the other student’s class diagrams to see how they defined
their classes.
DISCUSSION