0% found this document useful (0 votes)
11 views16 pages

OOP Assignments Overview and Solutions

The document outlines various assignments related to Object Oriented Programming (OOP) submitted by a student named Akhil Hegde. It includes tasks such as implementing recursion for factorial calculation, creating classes for shapes and banking systems, and demonstrating concepts like operator overloading and exception handling. Each assignment is accompanied by code snippets and expected outputs.

Uploaded by

akhilhegde0118
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views16 pages

OOP Assignments Overview and Solutions

The document outlines various assignments related to Object Oriented Programming (OOP) submitted by a student named Akhil Hegde. It includes tasks such as implementing recursion for factorial calculation, creating classes for shapes and banking systems, and demonstrating concepts like operator overloading and exception handling. Each assignment is accompanied by code snippets and expected outputs.

Uploaded by

akhilhegde0118
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Object oriented programming

All OOP assignments submission :-

Name: Akhil Hegde

Rollno: 56
PRN: 12411152

Branch:- CSSE

Div and batch: A-3

1a) code and output:

1b)
1c)
1d)
Assignment 2
2a)

Factorial using Recursion:


2b)

Prime Number Check


Assignment 3
3a) Rectangle class:
3b)banking class code:-
Output:-

3c) static data members:

3d) This pointer


3e) operator overloading with friend function

3f) comparative operator overloading


Code:-

Ouput:-

Assignment 4

4a) a) Build a hierarchy of classes representing different shapes (e.g., Circle,

Triangle, Rectangle) with a common base class. Implement a virtual function


for calculating the area of each shape.

Code:-
Output:- first is area of circle with radius 5 and second is rectangle with
length 6 and breadth 4.

4b) b) Extend the banking system to include different types of accounts


(Savings, Checking) that inherit from a common Account class. Implement
polymorphic behaviour for interest calculations.
Code:-

Output:-
Assignment 5:

Write a program using try, catch, and throw for arithmetic


and input errors.
Code:-
Output:-

Assignment 6

Write a function template for finding the maximum of two values.


Code and output:-

You might also like