Assignment No 2 OOP
Assignment No 2 OOP
Major Assignment
Q1. Write a C++ program to define a base class Item (item-no, name,
price). Derive a class Discounted-Item (discount-percent). A customer
purchases 'n' items. Display the item-wise bill and total amount using
appropriate format.
Items discounteditem
Item_no Discountpercednt
Name Percentage
price Display
Input
output
Q2. Write a C++ program to design a base class Person (name, address,
phone_no). Derive a class Employee (eno, ename) from Person. Derive
a class Manager (designation, department name, basic-salary) from
Employee. Write a menu driven program to:
Employee Manager
Person
Eno Deptname
name
designation Basicsalary
address
phno Input1 Input2
Input Output1 Output2
Output
higestsalarydetia
l
Q3. Create a base class Patient (pat-name, age, sex) and IPD (ward-no,
bed-no, charge-per-day). Derive a class IPD-patient from these two
base classes with no-of-days-admitted attribute. Use Multiple
Inheritence for this Question.
Patient IPD
Patientname Ward_no
Age Bed_no
Charge_per_day
Accept_details Accept_ipd_details
Display_detail Display_ipd_detail
s s
IPD_Patient
No_of_days_admit
input_details
Display_details
Q4. In a bank, different customers have savings account. Some
customers may have taken a loan from the bank. So bank always
maintains information about bank depositors and borrowers.
Derive two classes as Fulltime (daily rate, number of days, salary) and
Parttime (number of working hours, hourly rate, salary).
Write a menu driven program to:
1. Accept the details of ‘n’ employees.
2. Display the details of ‘n’ employees.
3. Search a given Employee by emp-code. Parttimeemplyee
Per_day_rate
Employee fulltimeemployee
Working_hours
Emp_no Daily_rate
Salary1
Name Days
Get1()
Get() Salary
Calculate1()
Getdata()
Show1()
Calculate()
Show()