![Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780134700144/9780134700144_largeCoverImage.jpg)
(Algebra: multiply two matrices) Write a method to multiply two matrices. The header of the method is:
public static double[][] multiplyMatrix(double[] [] 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 + . . . + ain × bnj·
For example, for two 3 × 3 matrices a and b, c is
where cij = ai1 × b1j + ai2 × b2j + . . . + 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:
![Check Mark](/static/check-mark.png)
Want to see the full answer?
Check out a sample textbook solution![Blurred answer](/static/blurred-answer.jpg)
Chapter 8 Solutions
Introduction to Java Programming and Data Structures Comprehensive Version (11th Edition)
Additional Engineering Textbook Solutions
Starting out with Visual C# (4th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Starting Out with C++: Early Objects
Concepts Of Programming Languages
Artificial Intelligence: A Modern Approach
- (Algebra: multiply two matrices) Write a method to multiply two matrices. The header of the method is: public static double[][] multiplyMatrix(double[][] 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 + g + ain × bnj. For example, for two 3 × 3 matrices a and b, c is where cij = ai1 * b1j + ai2 * b2j + 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: Ps: pls do the same header and the output is the same on the picture thanksarrow_forward(Algebra: add two matrices) Write a method to add two matrices. The header of the method is as follows: public static double[][] 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 x 3 matrices a and b, c is b11 b12 b13 9.Eミ9 (a11 + b11 a12+ b12 a13 + b13 a21 + b21 a2 + b22 an + b3 |a31+ b31 a32 + b32 a33 + b33 a11 a12 a13 a21 a22 a23 + b21 b2 bz3 a31 a32 a33 b31 b32 b33, Write a test program that prompts the user to enter two 3 x 3 matrices and displays their sum. Sample Run for Exercise08_05.java Enter input data for the program (Sample data provided below. You may modify it.) 12 3 4 5 6 7 8 9 e 2 4 1 4.5 2.2 1.1 4.3 5.2 Show the Sample Output Using the Preceeding Input Reset Execution Result: JDK8>java Exercise08_05 Enter matrixl: 1 23 4 5 6 7 8 9 Enter matrix2: 0 2 4 1 4.5 2.2 1.1 4.3 5.2 The…arrow_forward(Algebra: add two matrices) Write a method to add two matrices. The header of the method is as follows: public static double[][] 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 2 * 2 matrices a and b, c is Write a test program that prompts the user to enter two 2 * 2 matrices and displays their sum.arrow_forward
- (Algebra: add two matrices) Write a method to add two matrices. The header of the method is as follows: public static double[][] 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 2 * 2 matrices a and b, c is Write a test program that prompts the user to enter two 2 * 2 matrices and displays their sum. Here is a sample run: Ps: pls do the exact output thanks!arrow_forward(Java) Suppose we have a 2D array of integers called matrix. Write a code to initialize the array matrix with random values between 0-99.arrow_forward(Algebra: add two matrices) Write a method to add two matrices. The header ofthe method is as follows:public static double[][] 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.in javaarrow_forward
- (Maximum element in an array) Implement the following method that returns the maximum element in an array . public static > E max (E[] list) Write a test program that prompts the user to enter 10 integers, invokes this method to find the max.arrow_forward(Java) Suppose we have a 2D array of integers called a matrix. Write a code to initialize the array matrix with random values between 0-99. Please use a method instead of tryarrow_forward(Using Java in eclipse) Suppose we have to declare a two dimensional array called matrix with each dimension having some length. Write a message to initialize this array with random values between zero and 99. Hint: set each individual element of the right to random valuearrow_forward
- Write a menu driven C++ program that should perform following operation on matrices using 2D arrays. (Use OOP) The program will first take inputs for both matrices from the user then perform following operations on them: Add() This method will add two matrices. Subtract() This method will subtract two matrices. AddScalar() This method will add scalar to a matrix by asking user in which matrix to add. SubtractScalar() This method will subtract a scalar from a matrix by asking user in which matrix to add. Dont use pointers please use counters only.. Thank you very much.arrow_forward(Java in Eclipse) Write code that finds the sum of two matrices. Use the following method header public static int[][] addMatrix(int[][] a, int[][] b) The rules for adding two matrices are:1. both matrices should have the exact same dimensions (i.e. height and width) – you need to check for this rule in your program.2. both matrices should have elements that have compatible types – you don’t have to add extra code to check this rule in your method as it will only accept int arrays included is a test class and a sample runarrow_forward(IN JAVA) Write a method which does the following: Ask the user to enter a size of array between 2 to 10. Based on the size entered, write a loop which asks the user to fill values into an integer array. Print the array contents using Arrays.toString(). For this integer array, write a logic that returns true if there exists a place to split the array such that the sum of the numbers on one side is equal to the sum of the numbers on the other. Otherwise return false. Examples: If the array is {1, 1, 1, 2, 1} then return true. If the array is {2, 1, 1, 2, 1} then return false If the array is {10, 10} then return true.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
![Text book image](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Text book image](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)