Assignment List For Bca-3 SEMESTER, 2017 Subject: Object Oriented Programming Using C++ Assigned By: Dr. Samarjit Das
Assignment List For Bca-3 SEMESTER, 2017 Subject: Object Oriented Programming Using C++ Assigned By: Dr. Samarjit Das
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.
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.
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