OOPS LAB - INHERITANCE
Ex 6 A- Multilevel Inheritance
Set 1. Student Result System
Classes: Student → Marks → Result
Tasks:
- Read student ID and name in class Student.
- Read marks of three subjects in class Marks.
- Calculate total marks in class Result.
- Calculate average marks.
- Display the complete student result.
Set 2. Employee Salary System
Classes: Employee → Salary → TotalSalary
Tasks:
- Store employee ID and name.
- Store basic salary and allowance.
- Calculate gross salary.
- Calculate annual salary.
- Display complete employee salary details.
Set 3. Vehicle Information System
Classes: Vehicle → Car → SportsCar
Tasks:
- Store vehicle number and brand.
- Store fuel type and mileage.
- Store maximum speed and price.
- Display full vehicle details.
- Calculate fuel needed for a given distance.
Set 4. Bank Account System
Classes: Account → SavingsAccount →
Transaction
Tasks:
- Store account number and holder name.
- Store balance and interest rate.
- Perform deposit operation.
- Perform withdrawal operation.
- Display updated account balance.
Set 5. Library Management System
Classes: Book → Author → Library
Tasks:
- Store book ID and title.
- Store author name and publisher.
- Display book details.
- Store number of copies available.
- Display availability status.
Set 6. College System
Classes: Person → Teacher → Professor
Tasks:
- Store name and age.
- Store subject and employee ID.
- Store department and research area.
- Display complete faculty information.
- Display subject handled by professor.
Set 7. Product Billing System
Classes: Product → Price → Bill
Tasks:
- Store product ID and product name.
- Store unit price and quantity.
- Calculate total bill amount.
- Apply discount if applicable.
- Display final bill.
Set 8. Online Course System
Classes: Course → Instructor → OnlineCourse
Tasks:
- Store course name and duration.
- Store instructor name and experience.
- Store course fee and platform.
- Display complete course details.
- Calculate discounted fee.
Set 9. Hospital Management System
Classes: Patient → Diagnosis → Treatment
Tasks:
- Store patient ID and name.
- Store disease name and doctor name.
- Store treatment cost.
- Calculate total hospital bill.
- Display patient treatment details.
Set 10. Mobile Phone Specification
Classes: Mobile → Features → Smartphone
Tasks:
- Store mobile brand and model.
- Store RAM and storage capacity.
- Store camera resolution and battery capacity.
- Display phone specifications.
- Display storage availability.
Ex 6B - Multiple Inheritance
Set 1.
Develop a C++ program to implement multiple
inheritance where a class Result inherits from the classes Student and
Sports.
The class Student should store student ID and name, and the class Sports should
store sport name and score. Display the combined student sports record.
Set 2.
Write a C++ program using multiple
inheritance in which a class Report inherits from the classes Employee and
Work.
The class Employee stores employee ID and name, and the class Work stores
number of hours worked and project name. Display the employee work report.
Set 3.
Construct a C++ program to demonstrate multiple
inheritance where a class Teacher inherits from PersonalDetails and
TeachingDetails.
The class PersonalDetails contains name and age, and TeachingDetails contains
subject and years of experience. Display the full teacher profile.
Set 4.
Develop a C++ program using multiple
inheritance in which a class Purchase inherits from Product and Price.
The class Product contains product ID and product name, and Price contains unit
price and quantity. Calculate and display the total purchase cost.
Set 5.
Write a C++ program to demonstrate multiple
inheritance where a class Registration inherits from Vehicle and Owner.
The class Vehicle stores vehicle number and model, and the class Owner stores
owner name and address. Display the vehicle registration details.
Set 6.
Construct a C++ program using multiple
inheritance where a class MedicalRecord inherits from Patient and
Diagnosis.
The class Patient contains patient ID and name, and Diagnosis contains disease
name and doctor name. Display the complete patient medical record.
Set 7.
Develop a C++ program to implement multiple
inheritance in which a class OrderDetails inherits from Customer and Order.
The class Customer stores customer ID and name, and the class Order stores
order ID and product name. Display the complete order information.
Set 8.
Write a C++ program demonstrating multiple
inheritance where a class LoanDetails inherits from Customer and Loan.
The class Customer contains customer ID and name, and the class Loan contains
loan amount and interest rate. Calculate and display the total repayment
amount.
Set 9.
Construct a C++ program using multiple
inheritance in which a class Phone inherits from Mobile and Features.
The class Mobile contains brand and model, and the class Features contains RAM
and storage capacity. Display the complete mobile phone specifications.
Set 10.
Develop a C++ program to implement multiple
inheritance where a class Performance inherits from Academic and Sports.
The class Academic contains subject name and marks obtained, and the class
Sports contains sport name and score. Display the overall performance of the
student.
Comments
Post a Comment