Professional Documents
Culture Documents
A2 AssignmentMatrices
A2 AssignmentMatrices
A2 AssignmentMatrices
Discussion with your class fellows is encouraged but plagiarism in all forms (copy someone’s code or sharing
your code with others) is strictly prohibited and will result in non-positive (negative) marks.
3 x 4 Matrix 3 x 3 Matrix
For the matrices used in algebra, several binary operations (i.e. operations involving two matrices) are
defined on the set of all possible matrices with each binary operations combining two matrices to form
a new matrix. Some well-known binary operations defined on the set of all matrices are listed below.
List of Binary Operations Defined on Matrices
Plus, Minus, Multiply, Divide (Matrix (+\-\*\ /) Matrix, Matrix (+\-\*\ /) = Matrix ) where
division can be point by point division or some other definition of division
For this assignment you must design a hierarchy of two classes named dynamic2DArray and Matrix
respectively.
The dynamic2DArray class will be used to create a 2D array of real numbers having M rows and N
columns with M and N being non-negative integers representing the size of the matrix. At minimum,
you must provide the following functionality for this class.
I/O from an I/O stream by overloading the stream operations and I/O from a file
Safe access of any element of the array by specifying index. Make sure that user is allowed to use
any index (positive or negative value) with -1 representing the last valid index -2 the second last …
The Matrix class will inherit the functionality of dynamic2DArray class and extend it by providing
all the binary and unary operations defined in the lists of binary and unary operations defined above.
You are also required to provide a program (main function) that will allow the user to demonstrate
each of the function created in the two classes. It might be a good idea to create a menu for the user
to test your functionality.
You will submit the assignment in three parts