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

Write a program in java using two dimensional arrays. You should prompt the user

ID: 3640622 • Letter: W

Question

Write a program in java using two dimensional arrays. You should prompt the user to
enter the number of rows and columns for your matrix. You should then prompt the user
to enter values for each element of the matrix. Once the user has provided all the values for matrix, you should print the matrix and transpose of that matrix. A transpose of a matrix converts rows to columns and columns to rows.

Example:
Output: This program transposes a matrix.
Output: Please enter the number of rows:
User enters 2
Output: Please enter the number of columns:
User enters 3
Enter value for row[0] column[0]: 9
Enter value for row[0] column[1]: 1
Enter value for row[0] column[2]: 2
Enter value for row[1] column[0]: 72
Enter value for row[1] column[1]: 3
Enter value for row[1] column[2]: 6
The matrix you entered is:
9 1 2
72 3 6
The transpose of this matrix has 3 rows and 2 columns and the transpose is:
9 72
1 3
2 6

Explanation / Answer

This program should do exactly what you wanted. Link: - http://dl.dropbox.com/u/28713122/Cramster/Traverse2D.java --------------------------------- Source Code: import java.util.Scanner; public class Traverse2D { public static void main(String[] args) { Scanner input = new Scanner(System.in); int rows, columns; System.out.println("This program transposes a matrix."); System.out.print("Please enter the number of rows: "); rows = input.nextInt(); System.out.print("Please enter the number of columns: "); columns = input.nextInt(); int[][] matrix = new int[rows][columns]; int[][] tmatrix = new int[columns][rows]; for(int i = 0; i
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