0% found this document useful (0 votes)
10 views1 page

Assignment #1 OOP

The document outlines an assignment for Programming Fundamentals that includes instructions for submission and academic integrity. It consists of two main questions requiring the implementation of C++ programs involving friend functions, classes, and various systems such as a Bank Account Management System, Geometry Calculator, and Student Record Management System. Each task specifies the design and functionality expected from the C++ code.

Uploaded by

pcpc4289
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)
10 views1 page

Assignment #1 OOP

The document outlines an assignment for Programming Fundamentals that includes instructions for submission and academic integrity. It consists of two main questions requiring the implementation of C++ programs involving friend functions, classes, and various systems such as a Bank Account Management System, Geometry Calculator, and Student Record Management System. Each task specifies the design and functionality expected from the C++ code.

Uploaded by

pcpc4289
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
You are on page 1/ 1

Programming Fundamentals

Assignment - 01
Please Remember:

• The assignment must be submitted within the specified deadline.


• Prior to submitting, verify your name, registration number, program, and section details on
your assignment sheets.
• Copying/Cheating, whole or part of the assignment from anywhere will not be tolerated.
Whether you have copied or your work has been copied by someone else, you will get zero
marks in that assignment.

Q.1. Write a C++ program for the given tasks comprising friend functions and friend classes.

a. Basic Friend Function Implementation


Define a class Rectangle with private attributes width and height. Write a friend function
calculateArea that takes a Rectangle object and returns its area.

b. Friend Function with Multiple Classes


Create two classes A and B where class A has a private attribute x and class B has a private
attribute y. Write a friend function swapValues that swaps the values of x and y.

c. Friend Class for Complex Operations


Implement a class Complex with private attributes real and imaginary. Create a friend class
ComplexOperations that provides methods to add, subtract, and multiply two Complex
numbers.

Q.2. Write the C++ Code for each of the following Program.

a. Bank Account Management System


• Design a class named BankAccount with private member variables such as account number,
account holder name, balance, etc.
• Implement member functions for deposit, withdrawal, and display account information.
• Create multiple objects of the BankAccount class and perform transactions (e.g., depositing
money, withdrawing money) on each account.

b. Geometry Calculator:
• Design classes for different geometric shapes (e.g., Circle, Rectangle, Triangle) with
attributes like dimensions, area, perimeter, etc.
• Write member functions to calculate area and perimeter for each shape and display shape
details.
• Create objects of the geometric shape classes and calculate area and perimeter for various
shapes.

c. Student Record Management System:


• Design a Student class with private member variables such as roll number, name, and
marks.
• Implement parameterized constructors to initialize student objects with different sets of data.
• Create destructor to deallocate memory and perform cleanup tasks.
• Write a program to create multiple Student objects using different constructors and
demonstrate the destruction of objects when they go out of scope.

You might also like