Write a java program called RowSorting that sorts the rows in a two dimensional
ID: 3768243 • Letter: W
Question
Write a java program called RowSorting that sorts the rows in a two dimensional 3x3 array that contains values entered in by the user.
In your main() method you will ask the user enter the values for the array one row at a time. And your main() method must call the following method to accomplish the task of separately sorting each row of the array:
Note that a new array with the sorted rows is returned by this method while the original array is left unchanged.
Design the main() method of your program such that it allows the user to re-run the program with different inputs (i.e., use a loop structure).
Here is a sample output:
Explanation / Answer
import java.util.Scanner; public class sdfjasdf { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("What is the dimension of your matrix?"); int matrixdim = input.nextInt(); double[][] matrix = new double[matrixdim][matrixdim]; System.out.println("Enter " + matrixdim + " rows, and " + matrixdim + " columns."); Scanner input1 = new Scanner(System.in); for (int row = 0; rowRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.