Post on 13-Sep-2015
DFC 3013 OBJECT ORIENTED PROGRAMMING
Page 1 of 8
WORKBOOK ACTIVITY
ANSWER SCHEME (Lab Exercise 1)
DFC 3013 OBJECT ORIENTED PROGRAMMING
Page 2 of 8
DFC 3013 OBJECT ORIENTED PROGRAMMING
Page 3 of 8
ACTIVITY 1: Introduction to C++ Programming
Duration: 2 Hours
Learning Outcomes This Labsheet encompasses activities 1A, 1B, 1C, 1D,1E and 1F By the end of this lab, students should be able to :
Illustrate the basic terminologies of OOP: Classes, Object, Encapsulation, Data Abstraction, Inheritance and Polymorphism.
Distinguish between abstraction and encapsulation
Activity 1A Activity Outcome: Illustrate the basic terminologies of OOP: Classes Procedure: Step 1: Based on below Car class figure, identify class, object and it relationship with attributes
and method. Step 2: Fill in the identification output in designated blank space.
DFC 3013 OBJECT ORIENTED PROGRAMMING
Page 4 of 8
Activity 1B Activity Outcome: Illustrate the basic terminologies of OOP: Object Procedure: Step 1: Based on below MyCar object from class Car, identify object and it relationship with
attributes and method. Step 2: Fill in the identification output in designated blank space.
Activity 1C Activity Outcome: Illustrate the basic terminologies of OOP: Classes and Object Procedure: Step 1: By using concept of class and object in OOP, illustrate Class Phone and Object
MyPhone by including it relationship with attributes and method. Step 2: Put both Class Phone and Object MyPhone into figure diagram as of Activity 1A and
1B. Step 3: Share and present the outcome of Class Phone and Object MyPhone
DFC 3013 OBJECT ORIENTED PROGRAMMING
Page 5 of 8
Activity 1D Activity Outcome: Illustrate the basic terminologies of OOP: Encapsulation, Data Abstraction, Inheritance and Polymorphism. Procedure: Step 1: Define the 4 basic concept of OOP. Step 2: List down advantages of each concept Step 3: Give real example of each of the concept. Step 4: Fill in the output in the table provided below.
OOP Concept Definition Benefits Real World Example
Encapsulation
Data Abstraction
Inheritance
Polymorphism
DFC 3013 OBJECT ORIENTED PROGRAMMING
Page 6 of 8
Activity 1E Activity Outcome: Illustrate the basic terminologies of OOP: Encapsulation, Inheritance and Polymorphism. Procedure: Step 1: Identify 3 OOP terminologies based on figure below Step 4: Fill in the output in the blank space provided below.
a.
DFC 3013 OBJECT ORIENTED PROGRAMMING
Page 7 of 8
b.
c.
DFC 3013 OBJECT ORIENTED PROGRAMMING
Page 8 of 8
Activity 1F Activity Outcome: Distinguish between abstraction and encapsulation Group Discussion Procedure: Step 1: List down the different between Abstraction and Encapsulation in Object Oriented Programming. Step 2: Fill in the output in the table provided below. Step 3: A representative (selected by the lecturer) from each group will present their sharing
Abstraction Encapsulation