Question: Please code in C++: Many mathematical problems require the addition, subtraction, and multiplication of two matrices. Write an ADT Matrix. You may use the following

Please code in C++:

Please code in C++: Many mathematical problems require the addition, subtraction, andmultiplication of two matrices. Write an ADT Matrix. You may use the

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 MatrixType public: MatrixType(); void MakeEmpty(); void Set Size (int rows Size, int colSize); void StoreItem(int item, int row, int col); void Add (MatrixType otherOperand, MatrixType& result); void Sub (MatrixType otherOperand, MatrixType & result); void Mult (MatrixType otherOperand, MatrixType & result); void Print (ofstream& outfile); bool AddSub Compatible (MatrixType otherOperand); bool Mult Compatible (MatrixType otherOperand); private: int values [MAX_ROWS] [MAX_COLS]; 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. Menu Driven Testing Interface The menu should contain the following options. (See processing notes for definition of ). O New Matrix Ask for width. Ask for height. Based on width and height, ask for the value of each position. This can be done one at a time, or row by row. Your choice. 1 Add Matrices Add first and second, leaving the result in the third 2 Subtract Matrices Subtract second from first, leaving the result in the third 3 Multiply Matrices Multiply first and second, leaving the result in the third 4 Print Matrix Print the matrix one row per line on DataOut 5 Quit Processing Notes 1. is a number between 0 and 9. This value is used as an index into an array of MatrixType. 2. The main function must include a Switch statement where the case expression is a user-defined enumeration type. This means that the command is recognized and its enumeration equivalent is sent back to be used in the case statement. 3. The driver must ensure the preconditions of the member functions of MatrixType. Report any errors that occur and continue processing. Sample Run The following is a sample of possible way to create a menu and accept matrix input. O X C:\Users\Erickson\Documents\Visual Studio 2015\Projects\MatrixTy... - Choice and parameters: 10 New Matrix Usage: 0 1 Add Matrices Usage: 1 2 Subtract Matrices Usage: 2 3 Multiply Matrices Usage: 3 4 Print Matrices Usage: 4 1 Add Matrices Usage: 1 2 Subtract Matrices Usage: 2 3 Multiply Matrices Usage: 3 5 Quit Usage: 5 Enter Choice and Parameters

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!