Object Oriented Programming with C++ (CSCT3205)

Computer Science - COS

Semester: Resit

Level: 300

Year: 2017

Page 1 of 1
SCHOOL: H.T.T.T.C. DEPARTEMENT: CS LECTURER(S): Mr. DEMANOU YMELE
COURSE CODE: ICT 226 COURSE TITLE: Object Oriented Programming OPTION: ICT 200
DATE: HALL: ……. TIME: 1 hr NATURE: Resit
INSTRUCTION: ………………………………………………………………………………… …………….
Exercise 1: (20 mks)
1. Briefly give two advantages of OOP over procedural programming paradigms
2. Explain the following concepts
- Encapsulation
- Polymorphism
- Inheritance
3. Give two advantages of inheritance
Exercise 2: (20 mks)
Create an employee class. The member data should comprise an int for storing the employee number and a float for
storing the employee’s compensation. Member functions should allow the user to enter this data and display it. Write
main() that allows the user to enter data for three employees and display it.
Exercise 3: (30 mks)
A pharmacy hires you to develop an application to manage drug stock. The software records for each drug the name an
expiry date. The “Drug” class is described as follow:
class Drug{
std::string name;
std::string ex_date; //example 22/11/18 i.e. dd/mm/yy
public:
Drug(std::string, std::string); //Constructor of class drug
~Drug(); //destructor of class drug
void add(std::string name);
void display();
};
1. Give the implementation of constructor, destructor and the methods of class dug
2. Write a main() program to exercise the Drug class. It should create an array of type Drug and then invite the
user to input data for up to 10 Drugs. Finally, it should print out the data for all the drugs
REPUBLIC OF CAMEROON
Peace Work Fatherland
***********
THE UNIVERSITY OF BAMENDA
***********
HIGHER TECHNICAL TEACHER TRAINING
COLLEGE (H.T.T.T.C.) BAMBILI
***********
DIRECTORATE OF STUDIES
**********
P.O.BOX 39 BAMBILI
REPUBLIQUE DU CAMEROON
Paix Travail - Patrie
***********
UNIVERSITE DE BAMENDA
***********
ECOLE NORMALE SUPERIEURE
D’ENSEIGNEMENT TECHNIQUE
***********
DIRECTION DES ETUDES
**********
Tél: 33 05 10 69
www.schoolfaqs.net