Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Create Matrix class to implement the following member functions 1. The constructors and the destructor 2. getSize( ) which returns the size of the

C++

Create Matrix class to implement the following member functions

1. The constructors and the destructor

2. getSize( ) which returns the size of the matrix

3. setValue( int position, int value) which sets the value in the matrix at given position

4. getValue (int position) which returns the current value at given position

5. an add method which adds two matrices together

6. a subtract method which subtract two matrices together

7. a multiply methods which multiplies two matrices together, if possible

8. an overlap function which overlaps two matrices together. For example: If you overlap two matrices A of size 4x2 and B of size 3x5, the resulting matrix C is of size 4x5.

image text in transcribed

Class definition should be general enough to consider different possible types.

Test your class by writing a driver 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

3. print both input matrices and the resulting matrix after addition and subtraction

4. 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.

B= 82651 39123 57314 82651 39123 57314 79000 A= 23 C=Aoverlap B 1 3 6 3 79 Here is another example. Consider matrix A of size 2x3 and matrix B of size 3x1, the overlapped matrix C is of size 2x3. C=Aoverlap B- 835 334 500 A= 235 B= 8 134 5 B= 82651 39123 57314 82651 39123 57314 79000 A= 23 C=Aoverlap B 1 3 6 3 79 Here is another example. Consider matrix A of size 2x3 and matrix B of size 3x1, the overlapped matrix C is of size 2x3. C=Aoverlap B- 835 334 500 A= 235 B= 8 134 5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions