CSC 221 Object Oriented Analysis, Design and Programming
CSC 221 Object Oriented Analysis, Design and Programming
INSTRUCTIONS:
A;?
' ? 15027001 :2013 Certified Knowledge Transforms
d
laGFl!.
150 9001:2015 Certified
'd?
Page ] of 4
(6 marks)
g) Study the following C++ program segment and answer the questions that follow.
cl.ass poirit- {
prxvaCe :
lxi w .Xy ?Y /
p';:>xn?F-? ('.la .r1.?'laa= .i-' z .in't" 3' .) {x??i ; '5???':j y ?> ('
palyli c 1
float: midx() ;
',7 <.'> la . c'.i '-jl 2-?a'. S 1=. .1'. ia-i. 'za' .x y ( ) r'
};
i) Identify two errors in the program providing a possible solution in each case.
(2 marks)
Explain the implication of using each of the access specifiers in the program.
(2 marks)
i) OOD
ii) OOP
b) Explain Use case diagram for Bank withdrawal: (8 marks)
The customer inserts the ATM card in an ATM machine and types in the PIN number.
The ATM system checks that the customer's PIN number is correct. Ifit is not, the
system cancels the transaction and rejects the card. If correct, the system presents
the customer with options of the amount to money to with draw and the customer
selects the amount to withdraw. The system then checks that the customer's
account has sufficient amount of money. If it does, the system debits the account
and dispenses the money. Otherwise, the system cancels the transaction.
c) Write a C++ program that will create a class named rectangle with length and breadth as its
member data. The class should also contain a constructor for initializing the dimensions and
z. $?X ?N;?
150 27001:2013 Certified Knovvledge Transforms 150 9001:2015 Certified
a
Page 2 of 4
two member functions for determining the area and perimeter of an object with length and
breadth as 10.5 and 7.O respectively. (8 marks)
Ii;@')'sz.
%..
150 27001:2013 Certified Knovvledge Transforms e 150 9001:2015 Certified
Page 3 of 4
QUESTION FIVE (20 MARKS)
a) Define the following terms as used in OOP:
i) super class; (2 marks)
ii) derived class. (2 marks)
iii) Scope resolution operator; (2 marks)
c) Write a C++ program that will implement a class named arithmetic with three integers
initialized to s, 7 and 10 respectively and a member function used to determine and
output the product of the integers. Use a parameterized constructor. (8 marks)
-END-
<?.'
Page 4 of 4