Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please follow the example output instruction. And use c++ language for solution. This is really important Many mathematical problems require the addition, subtraction, and multiplication

please follow the example output instruction. And use c++ language for solution. This is really important image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Many mathematical problems require the addition, subtraction, and multiplication of two matrices. Write an ADT Matrix, You may use the following class definition: const int MAX_ROWS = 10; const int MAX COLS = 10; class Matrix Type Bublic: Matrixivpe(); void Setsizelint rowssize, int colsizel; void Storeftemi(int item, int row, int col): void Add(MatrixType otherOperand, MatrixType\& result); void Sub(MatrixType otherOperand, MatrixType\& result): void Mult(MatrixType otherOperand, MatrixTvpe\& resait); void Print(): bool AddSubCompatible(Matrix Iype otheroperand): bool Multcompatible(Matrixtype otherOperand): vod Mult(MatrixType otherOperand, Matriotype 8 resuit), void Print(); bool AddSubCompatible(MatrixType otherOperand): bool MultCompatible(MatrixTvpe otherOperand); peivate: int values[MAX ROWS) (MAX_COLS): int numRows; int numcols; Fvery instantiation of MatrixT vpe will glve you a new matrix, initially, in the constructor, both the number of rows and the number of columms are set to 0 . This indicates that an empty matrix is created. Then, the user is asked to provide the number of rows, the number of columns, and the value for each combination of row and colarnn. To reppesent the matrices, you need to consider an array (Matrix(10)) of Matrixtype, initially, the length of this array, NumberofMatrices, is =0. The index of the array can be 0 to 9. i.e., there can be at most 10 matrices at any given tinve. Note that the class provides two member tunctions, AddSubCompatible and MultCompatible, to allow. the user to determine if the binary inatrix operations (addition, subtraction, and multiplicationf are possible, For example, adding a matrix of size 34 with another matrix 37 is infeasible. You need to check such necessary areconditions for each operation. If an operation is not possible, you should provide appropriate error message to user. An example of output Inter the correspondine number for your desied operation: 1 - get a new matrix; 2-add two matrices. 3 - sultract a matris from another; 4 - mulyiphy two matrices; 5 - print matrix, 6 - end the propram 1 A matrix with 00 is created. Enter the number of rows and the number of columns for this new matrie: 3 4 10099.317 Thank you. You now have total 1 matrices in system. Enter the corregponding number for your desired operation: 1 -get a new matrix; 2 - add two Elatrices: 3. subtract a matrix from anothei; 4 -multiply two matrices; 5 -print matric; 6 - pnd the program - Create Bof - tatad - Combine Pdr. + Send files + Stere files - The inyut is invalidi, Fiter the corresponding number for your desired operationd 1 - get a new msatrix; 2 -add two imatrices: Enter the corresponding number for your dosired operation: 1 - get a neww matric? - add two matrices. 3 - subtnct a matrix from another; 4 - multiply two matrices; 5 - print matrixe 6 - end the propram 5 [ 4793 167519 3-subtract a matrix from another, 4 - multiely two matrices, 5 - paint inatrig; 6 - fond the parsarim Suppose that you want to perform C. Aadl. thter A. II and C. 013 The oporation is not compatible. Enter the corresponding nuaber for your desined operation: 1 - got a new rimatrix: 2 - add two matrices: 3 - subtract a matros from another. 4 - multiply two matrices; 5 - print matrix; 6 - end the program 1 A matrix with 00 is created. Enter the mumber of rovs and the number of columns for this new matrix: 917.15 231125 12719 Enter the values. 9.1714 231125 12719 17.1612 Thank you. You now have total 2 matrices in system. Enter the cotrosponding number for your desired ogetation: 1 - Eet a new matrix; 2 - asdd two matrices) 3 - subtract a matrix from another. 4 - muttiply two matrices; 5 - print matrix; 6 - end the progtam 1 A matrix with 0x0 is created. Enter the number of rows and the number of columns: 43 Enter the values: 719136 5.275117 10.132015 Thank you. You now have total 3 matrices in system. A matrix with 00 is created. Enter the mumber of rows and the number of columns: 3 4. Futer the values: Inter the values: 1719.136 5312710 181032205 Thank you, You now have total 4 matrices ins shtem. Enter the corremonding number for your desired oporation: 1 - get a new matrix; 2 - add two matrices) 7. - subtract a matrix from another; 4- multiply two matrices; 5 - print matris, 6-end the program 8 5uppose that you want to perform C-AvB. Enter A, B and CF 023 Matrices and 2 are added and the result is stored in matrix 3. Enter the corresponding number for your desired operation: 1 - get a new matrix; 2-add twomatrices; 3. - subtract a matrix from anothere, 4 - multipls two matrices; 5 -print matrix; 6 -end the program Enter the matrix number for printinga 3 The matrix 3 is: 1126229 684.5636 110.112.312 Fiter the corresponding mamber for vour desired operation: 1 - get a nen matrix: 2 ili add two matrices. 3. subtract a matrix from another; 4 - multiply two matrices, 5 - print matrix, 6 -end the program I Suppose that you want to perform C=AB, Enter A1,B and C : 032 Matrix 3 is subtracted from matrix 0 , and the result is stoted in matrix2. Enter the corresponding number for your desired operation: 1 - get a new matrix; 2 . add two matrices; 3- subtract a matrix from another; 4 - multiply two matrices, 5 - print matrix, 6-end the program 4 Suppose that you want to perform C=AB. Enter A,B and C. 031 The operation is not compatible. Enter the corresponding number for your desired operation: 1 - get a new matrix; 2 - add two matrices: 3 - subtract a matrix from another; 4 - multiply two matrices; 5 - print matrix; 6 - end the program 1 A matrix with oxo is created, Enter the number of raws and the number of columns: 141712 176 0298 141112 116 9298 Thank you. You now have total 5 matrices in system. Enter the corresponding number for your desired opetation: 1 - Bet a now matrix, 2 add two matrices) 3 - subtract a matrix from another; 4 - multiply two matrices; 5 - print matric; 6 - end the program Suppose that you wast to perform C=AB. Enter A,B and C:014 Matrices 0 and 1 are multiplied, and the result is stored in matrix 4

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_2

Step: 3

blur-text-image_3

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions