Write a Java program that will
- read two 2x3 matrices A and B.
- compute their sum (C=A+B)
- print out the C matrix
Please write out code. No screen shots please.
import java.util.Scanner;
public class MatrixTwoByThreeAddition {
public static void main(String args[]) {
int i,j;
int matxOne[][] = new int[2][3];
int matxTwo[][] = new int[2][3];
int matxSum[][] = new int[2][3];
Scanner input = new Scanner(System.in);
// Reading the Matrix One Element From User.
System.out.println("Enter values for Matrix (2*3) One");
for(i = 0; i < 2; i++)
{
for(j = 0; j < 3; j++)
{
matxOne[i][j] = input.nextInt();
System.out.println(matxOne[i][j]);
}
}
// Reading the Matrix Two Element From User.
System.out.println("Enter values for Matrix (2*3) Two");
for(i = 0; i < 2; i++)
{
for(j = 0; j < 3; j++)
{
matxTwo[i][j] = input.nextInt();
}
}
// Adding the values of MatrixOne and MatrixTwo
for(i = 0; i < 2; i++)
{
for(j = 0; j < 3; j++)
{
matxSum[i][j] = matxOne[i][j] + matxTwo[i][j];
}
}
// Display the sum of the Matrices
for(i = 0; i < 2; i++)
{
for(j = 0; j < 3; j++)
{
System.out.println(matxSum[i][j]+"\t");
System.out.println();
}
}
}
}
Write a Java program that will - read two 2x3 matrices A and B. - compute...
Write a java program that will read the values for 3 matrices A, B, and C and store the result of their summation in matrix D. You need to use a method to read matrix values. Use another method to add the three 3x3 matrices (each is a 2 dimensional array with 3 rows and 3 columns). Finally, use a third method to print the value of the summation (matrix D). Write a test program that will cal the three...
3. Write a complete assembly language program to read two matrices (2-dim arrays) A and B and display the resulting matrix C, which is the sum of A and B. Procedures must be used to organize the code.
Write a C++ program to read two matrices with any size. Your program should have at least the following functions: Main() Read a matrix Add two matrices Subtract two matrices Multiply two matrices Divide two matrices Display a matrix
1. Write a java program to find the sum of the elements on the diagonal of a matrix. 2. Write a java program to add two matrices. 3. Write a java program to find a given value in a matrix. 4. Write a java program to multiply two matrices. 5. Write a java program to find the transpose of a matrix.
JAVA PROGRAM. I need to write a program in java that will perform matrix addition and both matrices have N rows and M columns, N>1 and M>1. The two matrices must be divided to four equal size sub-matrices and each sub-matrix has dimensions N/2 X M/2. I need to create four threads and each thread performs a sub-set of addition on one pair of the sub-matrices. I also need an extra thread for networking. The network part of this uses...
C++ Write a program to calculate the sum of two matrices that are stored inside two-dimensional arrays. Your program should include three functions: one for getting input data, one for calculating the sum of matrices, and one for printing the result. a) Function inputMatrix: This Function prompts the user to enter the data and stores data inside two-dimensional array. b) Function addMatrices: This function calculatesthe sum result of two matrices. c) Function printMatrix: This function prints the matrix to screen....
Programming Language: Java Please write a program that uses a recursive algorithm to compute the determinant of a matrix. It should read the order of the matrix, read the matrix, print it out, compute, and print the determinant. Your program should be able to evaluate multiple matrices on a single execution. For class purposes, your program should handle matrices up to and including those of order 6. You are required to use an array for this problem. Your solution must...
please write JAVA code: Your Own Exception Class Write a text-based (non-GUI) program to read in file that contains only positive numbers and outputs to the screen the sum of all numbers. Create your own exception class that describes the situation of a non-positive number. In your program, use this exception to handle this situation. Use other exception classes from the Java standard library to handle other I/O situations.
Write a C program for the following: (i) (ii) (iii) (iv) (v) A function to read an NxM matrix (from console input). A function to display the NxM matrix on the screen. A function to add these two matrices. A function to subtract these two matrices. A function to multiply these two matrices. The program must also contain a main function that will first declare two 3x3 matrices A and B, allow input of data for A and B (using...
in java 3) Sum. Write a program that prompts the user to read two integers and displays their sum. Your program should prompt the user to read the number again if the input is incorrect.