You are on page 1of 3

ASSIGNMENT LIST FOR BCA-3rd SEMESTER , 2017

SUBJECT : OBJECT ORIENTED PROGRAMMING USING C++


Assigned by: Dr. Samarjit Das

1. Write a program in C++ to define a class named student which


includes the following data members and member functions-
Data members: EnrNo, StdName, courseName, semester, session, marks (in
three subjects), totalMarks, rank.
Member functions: void getData() // which takes input from user
int total() // it calculates the total marks
int passFail() /*will return 1 if the student is passed
else it returns 0. A student is declared passed if he/she obtains more than or
equal to 30% in each subject or more than and equal to 50% in average. */
float avg() // returns average value
int findRank() /* rank is given to only those students
who have been declared passed. This function returns the rank of a student. */
void showData() /* displays the whole information of a
student. */

2. A class named Complex has the following data members and member
functions.
Data members: real, imaginary.
Member functions: Complex() /* which initialize the data members with value
0 */
Complex(int, int) /* a parameterized constructor which
assigns the data members with new values */
addDistance() /* takes two objects (of type Complex) as
formal parameters and returns an object of type complex
which carries the sum of the corresponding data members
of the two objects. */
showDistance() /* displays a complex number, say, 7+i5,
where 7 is the real part and 5 is the imaginary part. */
Implement the above using C++ as the programming language.

Page 1 of 3
3. Write a program in C++ to define a class named matrix which includes
the member functions-
getMatrix() // takes the inputs of a square matrix.
Determinant() // finds the determinant
Minor() /* finds the minor of the elements of the
determinant. */
CoFactor() /* finds the cofactor of the elements of the
determinant */
Transpose() // calculates the transpose of the matrix.
Adj() // calculates the adjoint of the matrix.
Inverse() // calculates the inverse of the matrix.

4. Write a program in C++ which illustrates the concept of a parameterized


constructor with default values.

5. Write a program in C++ which illustrates the concept of constructor


overloading. (Include a default constructor, a parameterized constructor and a
copy constructor in the same class).

6. Write a program in C++ which illustrates the concept of single


inheritance.

7. Write a program in C++ which illustrates the concept of multilevel


inheritance.

8. Write a program in C++ which illustrates the concept of multiple


inheritances.
9. Write a program in C++ which illustrates the concept of hierarchical
inheritance.

10. Write a program in C++ which illustrates the concept of data ambiguity in
multipath inheritance. Also, provide the solution to it.

Page 2 of 3
11. Suppose O1 is an object of a class named negate which includes data
members- m and cm. The statement O1; negates the value of the data
members m and cm of object O1.
Write a C++ program to implement the above.

12. Write a program in C++ which implements the following statement-


O3= O1 + O2; where O1, O2 and O3 are the objects of a class
named distance which includes data members- feet and inches.

13. str, str1 and str2 are three objects of a class named string.
The statement-
str = str1+ str2; concatenates two strings of objects str1, str2
and returns the resultant string which is assigned to str.
Write a C++ program to implement the above problem..

Page 3 of 3