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

OOP Practical Assignment2

This document outlines 10 programming assignments involving object-oriented concepts in C++. The assignments include: 1. Writing a function to return the sum of two integers and calling it from main. 2. Swapping two numbers using pass by reference. 3. Creating a menu-driven program using function overloading. 4. Defining a Book class with functions to input data, calculate total cost, and display purchase information.

Uploaded by

Hirpara Krush
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)
41 views

OOP Practical Assignment2

This document outlines 10 programming assignments involving object-oriented concepts in C++. The assignments include: 1. Writing a function to return the sum of two integers and calling it from main. 2. Swapping two numbers using pass by reference. 3. Creating a menu-driven program using function overloading. 4. Defining a Book class with functions to input data, calculate total cost, and display purchase information.

Uploaded by

Hirpara Krush
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/ 2

Shri Shambhubhai V.

Patel College of CS &BM


SYBCA Sem-3
Object Oriented Programming
Practical Assignment-2
Date: 24/7/22
1. Write a program using function which accept two integers as an argument and return its sum.
Call this function from main( ) and print the results in main( ).
2. Write a program to swap two numbers using pass by reference.

3. Write a Menu Driven program using overloading function.


1. Find Radius of Circle
2. area of Rectangle
3. Area of Triangle
4. Exit
4. Define a class BOOK with the following specifications :
Private members of the class BOOK are
BOOK NO integer type
BOOKTITLE 20 characters
PRICE float (price per copy)
TOTAL_COST() A function to calculate the total cost for N number of copies
where N is passed to the function as argument.
Public members of the class BOOK are
INPUT() function to read BOOK_NO. BOOKTITLE, PRICE
PURCHASE() function to ask the user to input the number of copies to be purchased. It
invokes TOTAL_COST() and prints the tota cost to be paid by the user.
5. Define a class REPORT with the following specification:
Private members :
adno 4 digit admission number
name 20 characters
marks an array of 5 floating point values
average average marks obtained
GETAVG() a function to compute the average obtained in five subject
Public members:
READINFO() function to accept values for adno, name, marks. Invoke the
function GETAVG().
DISPLAYINFO() function to display all data members of report on the screen.

6. Create two classes DB & DM. DM stores distances in Meters & Centimeters and DB in feet
& inches. Write a program which will take input for both class objects and then add object of
DM with object of DB. Use a friend function to carry out the addition operation.
7. Define a class to represent bank account. Include following members.
Data members:
1. Name of depositor
2. Account number
3. Type of Account (It may be saving or current)
4. Balance amount in account.
Member function:
1. To assign initial value.
2. To deposit an amount.
3. To withdraw an amount after checking the balance.
4. Display name and balance.
Write a main program to test the program.
8. Create a class time which contains hour and min as data member and gettime and puttime as
member function. Write a program to perform addition of two objects of class time using
objects as function argument.
Example:
Obj1= 2 hour 45 min
Obj2= 3 hour 30 min
Output= 6 hour 15 min
9. Define a class shopping_cart which contains the item_code and item_price as data member of
a class. Perform following operation.
1. Take an input for item.
2. Display total price of all items.
3. Remove item from the cart.
4. Display all items of a cart.
5. Exit
Create a menu drive program for all this operation.
10. Write a program for telephone directory which may contains name and phone number. To
perform following operation.
1. Add records
2. Display all records
3. Search phone number
4. Exit
Write a menu driven program to perform all operation.

Submission Date: 10/08/2022

You might also like