Create a Matrix class and implement the following member functions: in C++, A= The constructors and the destructor getSize() which returns the size of the matrix; setValue(int position, int value) which sets the value in the matrix at given position; • getValue (int position) which returns the current value at given position; an add method which adds two matrices together; ● ● ● a subtract method which subtract two matrices together; a multiply methods which multiplies two matrices together, if possible; an overlap function which overlaps two matrices together. The augment function takes two matrices A and B of size mlxnl and m2xn2, respectively, and produce a new matrix C of size mLxnL, where mL (resp. nL) is the largest between m1 and m2 (resp. nl and n2). The values of C will either come from the original matrices by overlapping matrix B over matrix A. Wherever a value is not available it initialized to default value 0. For example: If you overlap two matrices A of size 4x2 and B of size 3x5, the resulting matrix C is of size 4x5. 23 13 63 79 B= 82651 39123 57314 C = A overlap B = 82651 39123 57314 79000
Create a Matrix class and implement the following member functions: in C++, A= The constructors and the destructor getSize() which returns the size of the matrix; setValue(int position, int value) which sets the value in the matrix at given position; • getValue (int position) which returns the current value at given position; an add method which adds two matrices together; ● ● ● a subtract method which subtract two matrices together; a multiply methods which multiplies two matrices together, if possible; an overlap function which overlaps two matrices together. The augment function takes two matrices A and B of size mlxnl and m2xn2, respectively, and produce a new matrix C of size mLxnL, where mL (resp. nL) is the largest between m1 and m2 (resp. nl and n2). The values of C will either come from the original matrices by overlapping matrix B over matrix A. Wherever a value is not available it initialized to default value 0. For example: If you overlap two matrices A of size 4x2 and B of size 3x5, the resulting matrix C is of size 4x5. 23 13 63 79 B= 82651 39123 57314 C = A overlap B = 82651 39123 57314 79000
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 17PE
Related questions
Question
I'm having a very hard time creating a working code for this, can you please help? i need one working
![Here is another example. Consider matrix A of size 2x3 and matrix B of size 3x1, the
overlapped matrix C is of size 2x3.
A =
235
134
B =
8
∞35
C = A overlap B =
835
334
500
While the numerical values of the example are integers, the class definition should be general
enough to consider different possible types.
Test your class by writing a driver function that performs the following actions on the matrices
A, B, and C given in the example above:
1. initialize two matrices A and B
2. add A and B together and then subtracts them
4.
3. print both input matrices and the resulting matrix after addition and subtraction
print both input matrices and the resulting matrix after multiplication, if possible. If not
possible explain the reason of the error
5.
overlap the two matrices by using the overlap function.
6. display both input matrices and the output matrix produced by the overlap function.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9362b609-0066-49c5-9295-590fa7429347%2Fae9bea0f-95e5-431f-921e-57823be95f05%2F713u0zg_processed.png&w=3840&q=75)
Transcribed Image Text:Here is another example. Consider matrix A of size 2x3 and matrix B of size 3x1, the
overlapped matrix C is of size 2x3.
A =
235
134
B =
8
∞35
C = A overlap B =
835
334
500
While the numerical values of the example are integers, the class definition should be general
enough to consider different possible types.
Test your class by writing a driver function that performs the following actions on the matrices
A, B, and C given in the example above:
1. initialize two matrices A and B
2. add A and B together and then subtracts them
4.
3. print both input matrices and the resulting matrix after addition and subtraction
print both input matrices and the resulting matrix after multiplication, if possible. If not
possible explain the reason of the error
5.
overlap the two matrices by using the overlap function.
6. display both input matrices and the output matrix produced by the overlap function.
![Create a Matrix class and implement the following member functions:
in
C++,
The constructors and the destructor
getSize() which returns the size of the matrix;
setValue(int position, int value) which sets the value in the matrix at given position;
getValue (int position) which returns the current value at given position;
an add method which adds two matrices together;
a subtract method which subtract two matrices together;
a multiply methods which multiplies two matrices together, if possible;
an overlap function which overlaps two matrices together. The augment function takes
two matrices A and B of size mlxnl and m2xn2, respectively, and produce a new matrix
C of size mLxnL, where mL (resp. nL) is the largest between m1 and m2 (resp. nl and
n2). The values of C will either come from the original matrices by overlapping matrix B
over matrix A. Wherever a value is not available it initialized to default value 0.
For example: If you overlap two matrices A of size 4x2 and B of size 3x5, the resulting
matrix C is of size 4x5.
A=
●
●
23
13
63
79
B=
82651
39123
57314
C = A overlap B =
82651
39123
57314
79000](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9362b609-0066-49c5-9295-590fa7429347%2Fae9bea0f-95e5-431f-921e-57823be95f05%2F7e3wans_processed.png&w=3840&q=75)
Transcribed Image Text:Create a Matrix class and implement the following member functions:
in
C++,
The constructors and the destructor
getSize() which returns the size of the matrix;
setValue(int position, int value) which sets the value in the matrix at given position;
getValue (int position) which returns the current value at given position;
an add method which adds two matrices together;
a subtract method which subtract two matrices together;
a multiply methods which multiplies two matrices together, if possible;
an overlap function which overlaps two matrices together. The augment function takes
two matrices A and B of size mlxnl and m2xn2, respectively, and produce a new matrix
C of size mLxnL, where mL (resp. nL) is the largest between m1 and m2 (resp. nl and
n2). The values of C will either come from the original matrices by overlapping matrix B
over matrix A. Wherever a value is not available it initialized to default value 0.
For example: If you overlap two matrices A of size 4x2 and B of size 3x5, the resulting
matrix C is of size 4x5.
A=
●
●
23
13
63
79
B=
82651
39123
57314
C = A overlap B =
82651
39123
57314
79000
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 7 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage