Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need a help to creating code for this assignment, if you look at the picture and

ID: 3602237 • Letter: N

Question

Need a help to creating code for this assignment, if you look at the picture and within the code will have tasks and will show what to do. I have confused. This is new clear post.

public class MoreProducts
{
public static void main(String[] args)
{

// create the array A exactly as shown:
// 19 18 22 23
// 16 25 2 67
// 26 3 80 99
// 80 80 80 80
// 66 82 13 26
int[][] A = { {19,18,22,23} , {16,25,2,67} , {26,3,80,99} , {80,80,80,80} , {62,82,13,26};

// create the array B exactly as shown:
// 89 10
// 22 32
// 7 59
// 44 1
int[][] B = { {89,10}, {22,32} , {7,59} , {44,1} };

// prepare the product array C, currently empty (filled with 0's)
int[][] C = new int[A.length][B[0].length];
  
  
int m = ____________; // number of rows in Matrix A
int n = ____________; // number of columns in Matrix A, which must equal number of rows in Matrix B
int p = ____________; // number of columns in Matrix B

  
// compute the dot product of A and B, store the results in C
for (int i=____; i < ____; i++)
{
for (int j=____; j < ____; j++)
{
C[i][j] = 0;
for (int k=____; k < ____; k++)
// sum the values for C
C[i][j] += A[____][____]*B[____][____];
}

}

// print A
System.out.println("Matrix A ");
for (int i=____; i <____; ____) {
for (int j=____; j < ____; ____)
System.out.printf("%5d",A[____][____]);
System.out.println();
}
System.out.println();
// print B
System.out.println("Matrix B ");
for (int i=____; i< ____; ____) {
for (int j=____; j <____; ____)
System.out.printf("%5d",B[____][____]);
System.out.println();
}
System.out.println();
// print C
System.out.println("Matrix C ");
for (int i=____; i< ____; ____) {
for (int j=____; j < ____; ____)
System.out.printf("%5d",C[____][____j]);
System.out.println();
}

  
} // end main
} // end class

Explanation / Answer

public class MoreProducts
{
public static void main(String[] args)
{
// create the array A exactly as shown:
// 19 18 22 23
// 16 25 2 67
// 26 3 80 99
// 80 80 80 80
// 66 82 13 26
int[][] A = { {19,18,22,23} , {16,25,2,67} , {26,3,80,99} , {80,80,80,80} , {62,82,13,26}};
// create the array B exactly as shown:
// 89 10
// 22 32
// 7 59
// 44 1
int[][] B = { {89,10}, {22,32} , {7,59} , {44,1} };
// prepare the product array C, currently empty (filled with 0's)
int[][] C = new int[A.length][B[0].length];
  
  
int m = 4; // number of rows in Matrix A
int n = 4; // number of columns in Matrix A, which must equal number of rows in Matrix B
int p = 2; // number of columns in Matrix B

  
// compute the dot product of A and B, store the results in C
for (int i=0; i <4; i++)
{
for (int j=0; j < 2; j++)
{
C[i][j] = 0;
for (int k=0; k < 2; k++)
// sum the values for C
C[i][j] += A[i][k]*B[k][j];
}
}
// print A
System.out.println("Matrix A ");
for (int i=0; i<m;i++) {
for (int j=0; j <n;j++)
System.out.printf("%5d",A[i][j]);
System.out.println();
}
System.out.println();
// print B
System.out.println("Matrix B ");
for (int i=0; i<m;i++) {
for (int j=0; j <p;j++)
System.out.printf("%5d",B[i][j]);
System.out.println();
}
System.out.println();
// print C
System.out.println("Matrix C ");
for (int i=0; i<m;i++) {
for (int j=0; j <p;j++)
System.out.printf("%5d",C[i][j]);
System.out.println();
}
  
} // end main
} // end class

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote