Department of Information Technology,
Division of Physical Science,
G.C University, Faisalabad
Sessional Division
Class: BS (IT) Semester: 2nd
Subject: Object Oriented Programming Max. Marks: 10
Deadline: Your assignment must be submitted before or on due date
RULES FOR MARKING:
It should be clear that your assignment will not get any credit if:
o The assignment is submitted after due date.
o The assignment is copied.
Instructions:
o Write your roll no and name on your Assignment.
o Write just to the point.
o Understanding of Questions is part of Assignment.
Assignment No. 2
Question 01:
You are required to develop a C++ program that simulates an Employee Management
System using inheritance in Object-Oriented Programming (OOP). The system should be
able to store employee details such as name, ID, department, and salary. You need to create
a base class Employee with the basic details of the employee, and a derived class Manager
that will add additional functionality, like handling employee-specific bonuses.
Requirements:
1. Create a base class Employee:
o Data members: name, employeeID, department, salary
o Member function: displayEmployeeDetails() to display the employee details.
2. Create a derived class Manager:
o Add a data member bonus (for managing manager-specific bonus).
o Function calculateBonus() to calculate the manager’s bonus (e.g., 10% of
salary).
o Function displayManagerDetails() to display manager details along with
their bonus.
3. Functionality:
o Create multiple employee objects and a manager object.
o Display details for an employee and manager using polymorphism.
Question 02:
You are tasked with developing a C++ program for a Bank Account Management System
using inheritance in Object-Oriented Programming (OOP). The system will manage
Savings Accounts and Checking Accounts using a base class BankAccount and derived
classes SavingsAccount and CheckingAccount.
Requirements:
1. Create a base class BankAccount:
o Data members: accountHolderName, accountNumber, balance
o Functions:
▪ deposit(double amount) to deposit money into the account.
▪ withdraw(double amount) to withdraw money from the account (if
sufficient balance exists).
▪ displayAccountDetails() to display account details.
2. Create derived classes SavingsAccount and CheckingAccount:
o Add a specific feature in each class.
o SavingsAccount will have an additional feature for interest calculation (e.g.,
5% interest on the balance).
o CheckingAccount will have an overdraft limit feature (e.g., the account can
go negative up to a limit of Rs. 5000).
3. Functionality:
o Create accounts of both types (Savings and Checking).
o Perform deposit, withdrawal, and calculate interest or overdraft as required.
o Display account details after transactions.