Jill G.

asked • 09/07/22

Need help with coding

  1. We need to create a java program with the name “TheDotProduct2D.java”. This program will transpose a two-dimensional vector (array) using nested loops. Once transpose has occurred, the original and resulting transposed vector will be passed to a new method.
  2. Then create the “DotProd2D()” method that will take the original vector and the newly transposed vector as the two parameters. In this new method, we must use several nested loops to compute the dot product of the two vectors, also called matrix multiplication. Then before exiting the “DotProd2D()” method, call the “PrintVect2D()” to print the new dot product vector.
  3. Change the “my2D_wide” variable to be a 3x3 vector and run the program again, for example: int[][] my2D_wide={{1,3},{4,6},{15,16}};

Target Output1:

Original Vector:

{ 21,32,23,34

13,14,15,16 }


Transposed Vector:

{ 21,13

32,14

23,15

34,16 }


Dot Product of two Vectors:

{ 3150,1610

1610,846 }


Target Output2:


Original Vector:

{ 1,3

4,6

15,16 }


Transposed Vector:

{ 1,4,15

3,6,16 }


What does the Dot Product look like?


Any help is appreciated, thanks!


1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.