You are on page 1of 3

SINGHAM INSTITUTE OF MANGEMENT, PUNE-41 MCA-II (SEM-III) Object-Oriented Programming with C++


Date: Submission Date: Marks: 5

Note: 1. Submit the assignment on or before submission date. 2. Submit written Journal (No print outs are allowed) Use both Sided Journal Pages. Do not use note books/blank pages to write programs. Make separate C++ Journal. 3. Write output of each program. 4. Prepare the proper Index.

Chapters Covered: Functions in C++ , Classes and Objects 1) Write an inline function to obtain the cube of numbers.
2) Write a function power() to raise a number m to power n. the function takes double value for m and int value for n and returns the result. Use a default value of 2 for n to make function calculate squares when this argument is omitted. Write a main function that gets the value of m and n from the user to test the function. 3) Write a program to calculate area of square and rectangle. Use separate function for square and rectangle. Use concept of function overloading. Both the functions should return values to calling function. 4) Write a program to read matrix of size m x n and display it. Allocate memory for matrix dynamically. 5) Write a C++ program to swap two integers. Use pass by value, pass by reference and pass by address mechanisms. Main function will read two integers, pass those to swap functions. Display value before and after swapping in main function.

6) Write a C++ program to add two integer values, float values, double values ,char values
and two strings. Use concept of function overloading. The functions should return values to calling function. 7) Define a class to represent a bank account. Include the following members: Data Members Name of the depositor Account number Type of account Balance amount in the account Member Functions To assign initial values To deposit an amount To withdraw an amount after checking the balance

To display name and balance Write a main program to test the class for handling N customers. 8) Write a C++ class to implement stack and queue of integers. 9) Define a class to represent employee. Include following Data members: Employee code Employee Name Department Basic Salary Employee count for computer department (Static Member variable) Employee count for Management Department (Static Member variable) Member functions: To read employee details To display employee data To calculate net salary To display employee count for computer and management department. (Static member function) Write a main program to test the class for handling N customers. Note: - Use dynamic memory allocation for N customers. - Use default arguments for DA and HRA percentage, TA and PT. Main function will pass these values to calculate net salary function. 10) Define a class Student_Personal and Student_Acedemic representing students details having following class members. Class: Student_Personal Data Members: Student roll number Student name Student class Student division Member functions: To read student data To display student data To print Report card Class: Student_Acedemic Data Members: Integer Array to store marks of 6 subjects Total Percentage Member functions: To read marks of 6 subjects To calculate total and percentage Write a main function that prints report cards of N students. Note: - To print report card for student, function needs data from both the classes (i.e from Student_Personal and Student_Acedemic). 11) Write a C++ program to demonstrate use of memory dereferencing operators.


Define a class complex having following class members Data members: Real Imaginary Member function To read complex number To display complex number Non-member function To add two complex number. This function should accept two complex numbers and returns resulting complex number to main function. 13) Write a c++ program to demonstrate local classes.