Design a Java program to implement matrix arithmetic for square matrices (same number of rows and columns). You will need to use your math textbook or the Internet to generate a matrix with values 1 - 10.
Addition: See http://mathworld.wolfram.com/MatrixAddition.html
Subtraction: Figure it out!
Multiplication:
- Multiply two matrices: See http://mathworld.wolfram.com/MatrixMultiplication.html
- Multiply a matrix by a constant: Equivalent to multiplication of each element by that constant
Transposition: See http://mathworld.wolfram.com/Transpose.html
Matrix Trace: See http://mathworld.wolfram.com/MatrixTrace.html
Print (use printf)
Have another method called menu(), that should list the options for matrix operations for which you designed the previous functions, and an option to exit the program. Your program should loop until the user chooses to exit. In this loop, you are required to use a switch statement. Output provided below.
SAMPLE OUTPUT:
Your options are:
1) Add 2 matrices
2) Subtract 2 matrices
3) Multiply 2 matrices
4) Multiply matrix by a constant
5) Transpose matrix
6) Matrix trace
0) EXIT
Please enter your option: 2
Enter the size of the first matrix:
3 6
7 10
10 2
10 5
7 5
6 2
Second matrix is:
9 7
6 4