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

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!