Question: Difference of two matrices.java Write a program that accepts two 3 x 3 matrices and invokes a method to subtract them together. The formula for

Difference of two matrices.java

Write a program that accepts two 3 x 3 matrices and invokes a method to subtract them together. The formula for subtracting two matrices is shown below:

Difference of two matrices.java Write a program that accepts two 3 x

You will need:

1.) A scanner object to read the values that fill the arrays

2.) Three 2-dimensional arrays:

-One to store the values in the first 3x3 matrix

-One to store the values in the second 3x3 matrix

-One to store the difference of the values from the first two matrices

3.) A method that subtracts the two matrices using the formula above. The method should accept the first and second matrices as parameters (i.e. a and b,) and return an array. (The array should be returned to the matrix in part c.)

4.) Comments where necessary.

A sample of the output is shown below:

Enter matrix1: 29 28 27 26 25 24 23 22 21

Enter matrix2: 1 2 3 4 5 6 7 8 9

The difference of the matrices is:

29.0 28.0 27.0

26.0 25.0 24.0

23.0 22.0 21.0

-

1.0 2.0 3.0

4.0 5.0 6.0

7.0 8.0 9.0

=

28.0 26.0 24.0

22.0 20.0 18.0

16.0 14.0 12.0

6 11 12 13 11 12 13 21 22 23-21 22 23 21-D 21 a 22-D 22 a 23-D 23 31 3233 131 32 32 33-3

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!