need help filling in blanks in code to produce the correct o

need help filling in blanks in code to produce the correct output.

public class Lab5c
{
public static void main(String[] args)
{
// Insert your Identification String as a comment below.
//
  
// create the array A exactly as shown
int[][] A = { {10,55,4,89,39} , {45,9,49,98,23} , {4,8,90,23,9} , {8,32,80,2,31} };

// create the array B exactly as shown
int[][] B = ___________________________________________________________________;

// prepare the product array C, currently empty (filled with 0\'s)
int[][] C = __________________;

// compute the dot product of A\'s row 2, and B\'s column 1

int sum = ___________;

for (int i=__________; i <= __________; __________)
{
sum = sum + A[____][____]*B[____][____];
}

// set the value of C[2][1]
C[___][___] = ____________;
  
System.out.println(_________);
  
} // end main
} // end class

Solution

package chegg;

public class Lab5c
{
public static void main(String[] args)
{
// Insert your Identification String as a comment below.
//
  
// create the array A exactly as shown
int[][] A = { {10,55,4,89,39} , {45,9,49,98,23} , {4,8,90,23,9} , {8,32,80,2,31} };
// create the array B exactly as shown
int[][] B = {{40,1,16}, {90,3,7}, {9,2,22},{44,35,60},{18,67,21}};
// prepare the product array C, currently empty (filled with 0\'s)
int[][] C = new int[4][4];
// compute the dot product of A\'s row 2, and B\'s column 1
int sum = 0;
for (int i=0; i <=4 ;i++ )
{
sum = sum + A[2][i]*B[i][1];
  
}
// set the value of C[2][1]
C[2][1] = sum;
  
System.out.println(\"The dot product of A\'s row 2, and B\'s column 1 is : \"+C[2][1]);
  
} // end main
} // end class

=======================================================

output sample:--

The dot product of A\'s row 2, and B\'s column 1 is : 1616

---------------------------------------------------------------------------------------------

If you have any query, please feel free to ask

Thanks a lot

need help filling in blanks in code to produce the correct output. public class Lab5c { public static void main(String[] args) { // Insert your Identification S
need help filling in blanks in code to produce the correct output. public class Lab5c { public static void main(String[] args) { // Insert your Identification S

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site