Name of Institute: Institute of Technology and Engineering
Branch: B. Tech – Computer Science Engineering
Course code: CE0316
Course name: Object Oriented Concepts with UML
INDEX
No. Title Date Grade Signature
1. 1.1 Write a simple C++ program illustrating the basic
structure of a C++ program. Compare its structure with that of
a C program by highlighting the major differences.
2. 2.1 Write a program to calculate the area of circle, rectangle
and square using function overloading.
2.2 Write a program to demonstrate the use of default
arguments in function overloading.
2.3 Write a program to demonstrate the use of returning a
reference variable.
3 3.1 Create a class student which stores the detail about
roll no, name, marks of 5 subjects, i.e. science, Mathematics,
English, C++. The class must have the following:
● Get function to accept value of the data members.
● Display function to display values of data
members.
● Total function to add marks of all 5 subjects and store
it in the data members named total.
No. Title Date Grade Signature
3.2 Create a function power() to raise a number m to power
n. the function takes a double value for m and int value for n,
and returns the result correctly. Use the default value of 2 for
n to make the function calculate squares when this argument
is omitted. Write a main that gets the values of m and n from
the user to test the function.
3.3 Write a basic program which shows the use of scope
resolution operator.
3.4 Write a C++ program to swap the value of private data
members from 2 different classes using friend function.
.
4 4.1 Write a program to illustrate the use of this pointer.
4.2 An election is contested by five candidates, identified by
candidate numbers 1 to 5. Each voter casts a vote by entering
the corresponding candidate number.
Write a C++ program to:
● Read the votes cast by all voters.
● Store and count the votes received by each candidate
using an array.
● Treat any vote entered outside the range 1 to 5 as an
invalid (spoilt) vote.
● Display the total number of votes received by each
candidate and the total number of invalid (spoilt)
votes.
4.3 Write a program to call member functions of class in the
main function using pointer to object and pointer to member
function.
5. 5.1 Using the friend function, find the maximum number
from two numbers from two different classes. Write all
necessary functions and constructors for the program.
5.2 Using a friend function, find the average of three
numbers from three different classes. Write all necessary
member functions and constructor for the classes.
5.3 Define currency class which contains rupees and
paise as data members. Write a friend function
named AddCurrency ( ) which adds 2 different Currency
objects and returns a Currency object. Write a parameterized
constructor to initialize the values and use appropriate
functions to get the details from the user and display it.
No. Title Date Grade Signature
5.4 Create a Calendar class with day, month and year as data
members. Include default and parameterized constructors to
initialize a Calendar object with a valid date value. Define a
function AddDays to add days to the Calendar object.
Define a display function to show data in “dd/mm/yyyy”
format.
6. 6.1 Create a class named String with a data member of type
char* to store a character string. Include a default
constructor, a parameterized constructor, and a copy
constructor to initialize the data member. Write a C++
program to create objects of the class and test the
functionality of these constructors.
6.2 Write a base class named Employee and derive two
classes, FullTimeEmployee and PartTimeEmployee, from it.
Every employee has the following attributes:
Employee ID
Employee Name
Salary Scale (Hourly Rate)
Create a virtual function computePay() to calculate the
weekly payment.
A FullTimeEmployee is paid for a fixed 40 hours per week,
regardless of the actual hours worked.
A PartTimeEmployee is paid based on the actual number of
hours worked.
Write a C++ program to accept employee details, calculate
the weekly payment using runtime polymorphism, and
display the employee information along with the weekly
pay.
7. 7.1 Write a program with use of inheritance: Define a class
publisher that stores the name of the title. Derive two
classes: book and tape, which inherit publisher. Book class
contains member data called page no and tape class contain
time for playing. Define functions in the appropriate classes
to get and print the details
No. Title Date Grade Signature
7.2 Create a class account that stores customer name,
account no, types of account. From this derive classes
cur_acc and sav_acc to include necessary member function
to do the following:
● Accepts deposits from customers and updates
balance.
● Compute and Deposit interest.
● Permit withdrawal and Update balance
8. 8.1 Create a class vehicle which stores the vehicle no and
chassis as a member. Define another class for scooter, which
inherits the data members of the class vehicle and has a data
member for storing wheels and company. Define another
class for which inherits the data member of the class vehicle
and has a data member for storing price and company.
Display the data from the derived class. Use virtual
functions.
8.2 Write a program to demonstrate the use of pure virtual
function.
8.3 For multiple inheritance, write a program to show the
invocation of constructor and destructor.
9. 9.1 Create a class MARIX of size mxn. Overload + and –
operators for addition and subtraction of the MATRIX.
9.2 Create a class and overload the pre-increment and
post-increment operators using friend functions.
Demonstrate the working of both operators.
9.3 Create two classes Celsius and Fahrenheit to store
temperature in terms of Celsius and Fahrenheit respectively.
Include necessary Functions to read and display the values.
Define conversion mechanism To convert Celsius object to
Fahrenheit object and vice versa. Show both Types of
conversions in the main function.
10. 10.1 Write a program to illustrate the use of put(), get() and
getline() functions for Text mode Input/Output.
10.2 Write a program to illustrate the use of read() and
write() functions for Binary mode Input/Output.
10.3 Write down a program to Copy source file ‘[Link]’
to destination file.