Question: Please write in java! Please use directions in picture! Two different programs, 8.5 add two matrices, and 8.6 multiply two matrices. Thank you! CSCI 1302

Please write in java! Please use directions in picture! Two different programs, 8.5 add two matrices, and 8.6 multiply two matrices. Thank you!
 Please write in java! Please use directions in picture! Two different

CSCI 1302 Lab # 4 Multidimensional Arrays Programming Exercise 8.5 (Algebra: add two matrices) Write a method to add two matrices. The header of the method is as follows: public static double[J[] addMatrix(double[][) a, double()] b In order to be added, the two matrices must have the same dimensions and the same or compatible types of elements. Let c be the resulting matrix. Each element cij is aij + bij. For example, for two 3 * 3 matrices a and b, c is Write a test program that prompts the user to enter two 3 3 matrices and displays their sum. Here is a sample run Programming Exercise 8.6 (Algebra: multiply two matrices) Write a method to multiply two matrices. The header of the method is: public static double[]C] multiplyMatrix(double[J[] a, double[][) b) To multiply matrix a by matrix b, the number of columns in a must be the same as the number of rows in b, and the two matrices must have elements of the same or compatible types. Let c be the result of the multiplication. Assume the column size of matrix a is n. Each element cij is ai1 * b1j+ ai2 b2j + c+ ain * bnj. For example, for two 3 3 matrices a and b, cis where cij = ail * bl] + ai2 * b2] + ai3" b3j. Write a test program that prompts the user to enter two 3 3 matrices and displays their product. Here is a sample run

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!