0% found this document useful (0 votes)
8 views

Unit 3 - Week2

The document outlines several C++ programming exercises involving object-oriented concepts like inheritance, polymorphism, abstract classes, and friend functions. It also provides instructions to create activity diagrams and state chart diagrams for various applications.

Uploaded by

vinith gomez
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Unit 3 - Week2

The document outlines several C++ programming exercises involving object-oriented concepts like inheritance, polymorphism, abstract classes, and friend functions. It also provides instructions to create activity diagrams and state chart diagrams for various applications.

Uploaded by

vinith gomez
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Unit 3

Lab Program

Develop a C++ program to find out the payroll system using single inheritance for multiple
number of employees.

Create a C++ program to demonstrate Hybrid Inheritance. Define a base class Shape with a
virtual function calculate_area(). Derive two classes Rectangle and Circle from Shape using
single inheritance. Further, derive a class Cylinder from both Rectangle and Circle using
multiple inheritance. Implement necessary functions to calculate the area of the rectangle,
circle, and the volume of the cylinder.

Write a C++ Program to demonstrate an Example of Multiple Inheritance.

Abstract Class:
1.Create an abstract class Vehicle with pure virtual functions startEngine() and
stopEngine().Derive two classes Car and Motorcycle from Vehicle. Implement the
functions to display a message indicating the engine status. Additionally, implement a
function in the base class to demonstrate dynamic memory allocation for an array of
pointers to Vehicle objects.

2.Design an abstract class Shape with pure virtual functions calculateArea() and
displayInfo(). Derive three classes Circle, Rectangle, and Triangle from Shape.
Implement the functions to calculate the area and display information for each shape.
Create an array of pointers to Shape objects and demonstrate polymorphism.

3.Create an abstract class Person with pure virtual functions displayDetails() and
calculateSalary(). Derive two classes Employee and Manager from Person. Implement
the functions to display details and calculate the salary for each category. Create an
array of pointers to Person objects and demonstrate polymorphism.

Friend Function
Sum of n number of odd natural numbers by using friend class in C++.
Friend Function for Adding Two Complex Numbers
Friend Function for Calculating Average of 5 marks
Write a c++ program to Add members of two different classes using friend functions

Inline Function
C++ Program to demonstrate inline functions to perform
get(),sum(),difference(),product(),division() and classes
2.Write a C++ Program to display the reverse of a number using the Inline function.

Activity Diagrams:

Draw the activity diagram for Library management system.


Draw the activity diagram for Online shopping system.
Draw the activity diagram for Employee management system.
Draw the activity diagram for College management system.
The online shopping system offers a function that will significantly assist both buyers and sellers when
doing online shopping. Draw a Swimlane Activity Diagram for Online Shopping System to see
the activities between the customer and the shopping system.

Draw Activity diagram for Assignment Completion process.

State chart Diagrams


UML state chart diagrams for ATM application
UML state chart Diagrams for Online Banking System
UML state chart Diagrams for Online Book Shop
UML state chart diagrams for document editor

You might also like