OOPS LAB - INHERITANCE

 

Ex 6 A- Multilevel Inheritance

 

Set 1. Student Result System

Classes: Student → Marks → Result

Tasks:

  1. Read student ID and name in class Student.
  2. Read marks of three subjects in class Marks.
  3. Calculate total marks in class Result.
  4. Calculate average marks.
  5. Display the complete student result.

Set 2. Employee Salary System

Classes: Employee → Salary → TotalSalary

Tasks:

  1. Store employee ID and name.
  2. Store basic salary and allowance.
  3. Calculate gross salary.
  4. Calculate annual salary.
  5. Display complete employee salary details.

Set 3. Vehicle Information System

Classes: Vehicle → Car → SportsCar

Tasks:

  1. Store vehicle number and brand.
  2. Store fuel type and mileage.
  3. Store maximum speed and price.
  4. Display full vehicle details.
  5. Calculate fuel needed for a given distance.

Set 4. Bank Account System

Classes: Account → SavingsAccount → Transaction

Tasks:

  1. Store account number and holder name.
  2. Store balance and interest rate.
  3. Perform deposit operation.
  4. Perform withdrawal operation.
  5. Display updated account balance.

Set 5. Library Management System

Classes: Book → Author → Library

Tasks:

  1. Store book ID and title.
  2. Store author name and publisher.
  3. Display book details.
  4. Store number of copies available.
  5. Display availability status.

Set 6. College System

Classes: Person → Teacher → Professor

Tasks:

  1. Store name and age.
  2. Store subject and employee ID.
  3. Store department and research area.
  4. Display complete faculty information.
  5. Display subject handled by professor.

Set 7. Product Billing System

Classes: Product → Price → Bill

Tasks:

  1. Store product ID and product name.
  2. Store unit price and quantity.
  3. Calculate total bill amount.
  4. Apply discount if applicable.
  5. Display final bill.

Set 8. Online Course System

Classes: Course → Instructor → OnlineCourse

Tasks:

  1. Store course name and duration.
  2. Store instructor name and experience.
  3. Store course fee and platform.
  4. Display complete course details.
  5. Calculate discounted fee.

Set 9. Hospital Management System

Classes: Patient → Diagnosis → Treatment

Tasks:

  1. Store patient ID and name.
  2. Store disease name and doctor name.
  3. Store treatment cost.
  4. Calculate total hospital bill.
  5. Display patient treatment details.

Set 10. Mobile Phone Specification

Classes: Mobile → Features → Smartphone

Tasks:

  1. Store mobile brand and model.
  2. Store RAM and storage capacity.
  3. Store camera resolution and battery capacity.
  4. Display phone specifications.
  5. 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