Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Solve in c + + and provide the input and output of the program with explanation. MatrixType Many mathematical problems require the addition, subtraction, and
Solve in c and provide the input and output of the program with explanation. MatrixType
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 MAXROWS ;
const int MAXCOLS ;
class MatrixType
public:
MatrixType;
void MakeEmpty;
void SetSizeint rowsSize, int colSize;
void StoreItemint item, int row, int col;
void AddMatrixType otherOperand, MatrixType& result;
void SubMatrixType otherOperand, MatrixType& result;
void MultMatrixType otherOperand, MatrixType& result;
void Printofstream& outfile;
bool AddSubCompatibleMatrixType otherOperand;
bool MultCompatibleMatrixType otherOperand;
private:
int valuesMAXROWSMAXCOLS;
int numRows;
int numCols;
;
Before you start looking at how to implement this class, you must determine and document the
appropriate preconditions and postconditions for each operation. Note that the class provides the
member functions to allow the client to determine if the binary matrix operations are possible. Before
this class can become a permanent part of your program library, it must be thoroughly tested. Write a
menu driven testing program to test your MatrixType.
Test Driver
The test driver should handle the following options. See processing notes for definition of
GetNewMatrix
Number of rows and number of columns are on the next line.
Values for each row and column
AddMatrices matrix, matrix, matrix
Add first and second, leaving the result in the third
SubMatrices matrix, matrix, matrix
Subtract second from first, leaving the result in the third
MultiplyMatrices matrix matrix, matrix
Multiply first and second, leaving the result in the third
PrintMatrix matrix
Print the matrix one row per line on DataOutrocessing Notes
matrix is a number between and This value is used as an index into an array of
MatrixType.
The main function must include a Switch statement where the case expression is a userdefined
enumeration type. This means that the command is recognized and its enumeration equivalent
is sent back to be used in the case statement.
The driver must ensure the preconditions of the member functions of MatrixType. Throw an
exception if an error occurs and continue processing.
Deliverables
Your MatrixType class
Your test driver
Your test plan and input to the test driver
The output file from the test driver
A copy of the screen from the run of the test driver
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started