Question
You are to write a java program named matrix.java that can multiply and add 2 matrices. Requriements: 1. Your program should prompt the user for
You are to write a java program named matrix.java that can multiply and add 2 matrices.
Requriements:
1. Your program should prompt the user for the dimensions of the two matrices, then check for compatibility (remember 2 matrices can be multiplied only if the column of the first is equal to the row of the second). You could prompt for ONE dimension and build two square matrices. Minimum dimension of matrix must be 25.
2. If the above is not met, prompt the user for new and compatible dimensions.
3. Now generate random integer numbers (ranging from 1 to 30) to fill both matrices.
4. Display these two matrices on the screen.
5. Multiply the two matrices and display the result on the screen.
6. Insert a clock to see how long it would take to multiply these two matrices and display the time (with a message to this effect).
7. Now add the two matrices and display the result on the screen.
8. Insert a clock to see how long it would take to add these two matrices and display the time (with a message to this effect).
9. Prompt the user asking if they want to repeat the program.
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