You are on page 1of 1

<<Your Name>>

<<Enrolment Number>>
Week 7
23-10-2023 (B-Section)
31-10-2023 (A-Section)

Use of Inheritance Concept in C++


Aim

Use the following concepts to implement the given programming problems in C++.

• Single Inheritance
• Multiple Inheritance
• Multi-level Inheritance
• Hierarchical Inheritance

Problem Statements

1. Design a class hierarchy for geometric shapes, including a base class Shape and derived classes
like Circle, Rectangle, and Triangle. Implement appropriate methods to calculate the area and
perimeter for each shape.

2. Define a Person entity. Create an employee hierarchy with a derived class Employee from the
Person class. Further, create derived classes for different types of employees (e.g., regular
employees, contractual employees, guest employees). Calculate their wages based on their
work hours and pay structure.

3. Construct and store the information of vehicle hierarchy with different entities like Motorized
and WithWheels. Create a class named Vehicle derived from Motorized and WithWheels with
a few data member named mileage, color, weight and price. Create its two subclasses Car
with data members to store ownership cost, warranty, seating capacity and fuel type (diesel
or petrol) and MotorCycle with data members to store the number of cylinders, number of
gears, wheel type (alloys or spokes) and fuel tank size (in litres). Make another two subclasses
Audi and Ford of Car class, each having a data member to store the model_type. Similarly,
make two subclasses Bajaj and TVS, each having a data member to store the make_type.
Implement relevant methods to describe different vehicles and print the information of cars
and motorcycles.

4. Create a class hierarchy for animals, with a base class Animal and derived classes for different
species (e.g., mammals, birds, reptiles). Implement relevant methods for displaying the sound
each animal makes.

5. Create a hierarchy for a banking system, with a base class Account and derived classes like
SavingsAccount and CurrentAccount. Implement relevant methods for transaction on these
accounts and interest calculation.

6. Design a university management system using inheritance, with base class for Person. Derive
Student and Professor class from Person. Create derived class Head that is derived from
Professor and show how student records would be managed at Professor and Head of the
department level. Create any other relevant entities required to implement this scenario.

You might also like