CS201 MID TERM SOLVED MCQs || PAST PAPERS || GROUP-1 || INTRODUCTION TO PROGRAMMING || VuTech Visit Website For More Solutions www.vutechofficial.blogspot.com …
CS201 ASSIGNMENT NO. 2 FALL 2022 || 100% RIGHT SOLUTION || INTRODUCTION TO PROGRAMMING || BY VuTech
Visit Website For More Solutions
www.vutechofficial.blogspot.com
SEND WHATSAPP OR E-MAIL FOR ANY QUERY
0325-6644800
kamranhameedvu@gmail.com
Instructions
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:
oAssignment is submitted after due date.
oSubmitted assignment does not open or file is corrupt.
oAssignment is copied (From internet/students).
Software allowed to develop Assignment
-Dev C++
Objectives:
To enable students to understand and practice the concepts of:
Classes and its structure.
Data Members and Member functions of a class.
Constructor of a class.
Friend function
Operator overloading
Assignment Submission Instructions
You are required to submit only .cppfile on the assignments interface of CS201 at VU-LMS.
Assignment submitted in any other format will not be accepted and will be graded zero marks.
So, check your solution file format before submission.
For any query related to assignment, please contact cs201@vu.edu.pk.
Problem Statement
Following property is true for any two matrices of same order:
(A + B) T = AT + BT
Here...
A & B are two matrices of same order.
T stands for transpose of a matrix.
ATand BTare transpose of matrices A and B respectively.
Left side of the above equation means:
Two matrices A and B are added first and then
The transpose of the resultant is computed.
Right side means:
Transpose of both matrices A and B are computed first and then
Their resultants (transposes) are added.
You have to write a program in C++ to find ONLYthe Left Hand Side of this property means (A + B) T.
For this purpose:
Write a class MatrixProperty:
This class should have:
ØA two dimensional array named matrix of integers of dimension 2 x 2.
ØA setter method setMatrix () which should assign the passed array to the array matrix.
ØIt should have two constructors:
·A default constructor which should initialize the array matrix to zero.
·A parametrized constructor which should take an array as a parameter and initialize the array matrix with this passed array.
vHere you should call the setMatrix() to do the task.
ØAn overloaded + operator which should take references to two objects of MatrixProperty and
·Add the two matrices(arrays) of these two objects.
·Return a reference to the resultant matrix.
ØA friend function Transpose() which should take one argument:
·a reference to an object of MatrixProperty
·Find transpose of this passed array matrix and
·Return a reference to this resultant matrix.
ØA function display() which could either take a reference to an object of MatrixProperty or use this pointer
·To display the passed matrix.
In the main() function, you should:
ØMake TWO instances of this class MatrixProperty using the following matrices(arrays).
ØAdd the above TWO created matrices using the overloaded + operator.
Call Transpose() function to find transpose of resultant(sum) matrix (done in the above step).
ØCall Display() function to:
vdisplay both matrices A and B.
vdisplay the sum(matrix).
vdisplay the transpose(matrix).
Note: You may use pointers to pass the array arguments to all functions and do the pointer arithmetic.
(Hint: Transpose of a matrix can be obtained by changing its rows into columns or columns into rows.)
(Hint: Two matrices can be added by adding their corresponding elements.)
For consistency of the assignment, please only use the above given matrices(arrays).
Note: Marks will be deducted if the given arrays are not used.
Sample Screenshot of Output:
Good Luck!
Lectures Covered: This assignment covers Lecture #23-31.
Deadline: The deadline to submit your assignment solution is 24th January 2023. Your assignment must be submitted within the due date through VU-LMS. No assignment will be accepted through email after the due date.
We provide Virtual University of Pakistan Study Materials such as Solution of Assignments, GDBs, Mid Term Solved Papers, Final Term Solved Papers, Mid Term Solved MCQs, and Final Term Solved MCQs. We also provide regular Semester Quizzes, Updated Handouts, and Short Questions and Answers. We help you with your research and many other educational-related topics, as far as we know. Furthermore, Share your problem with us and Please feel free to ask any related questions.