University of Technology, Jamaica School of Computing and Information Technology OOP Principles Tutorial Two - Classes and Data Abstraction Objective: The objectives of this tutorial are to allow students to be able to: - perform object-oriented analysis on a set of requirements - construct a model using the UML modeling language - implement the model in an object-oriented programming language Exercise One A B C H 1 .* 1 D F E J G 0 .. 1 K * Identify all the relationships in the UML relationship diagram above. Exercise Two Write C++ and Java code to implement the following classes and their relationship. You do not have to write a complete program, only the code for the classes. SystemUnit - Capacity : int - NoDrives : int + Display() : void CPU - NoCores : int - Speed : int + Display() : void SystemUnit CPU Prepared by David White 2011 Aug 27 Page 1 of 2
Exercise Three - Homework a) An Alpha has a Beta. A Beta is a Gamma. A Gamma many or may not have a Delta. b) A car has a steering, an engine and a wheel. A wheel is a circle. Sometimes a steering has a n airbag, but not always. c) A customer is associated with one or more account, and an account is associated with just one customer. Consider each of the above descriptions of requirements, then carefully construct the respective relationship diagram using UML. Prepared by David White 2011 Aug 27 Page 2 of 2