Java Reference
In-Depth Information
Write a test program that prompts the user to enter a matrix of double val-
ues and displays a new column-sorted matrix. Here is a sample run:
3
*
3
Enter a 3-by-4 matrix row by row:
0.15 0.875 0.375
0.55 0.005 0.225
0.30 0.12 0.4
The column-sorted array is
0.15 0.0050 0.225
0.3 0.12 0.375
0.55 0.875 0.4
7.28
( Strictly identical arrays ) The two-dimensional arrays m1 and m2 are strictly iden-
tical if their corresponding elements are equal. Write a method that returns true
if m1 and m2 are strictly identical, using the following header:
public static boolean equals( int [][] m1, int [][] m2)
Write a test program that prompts the user to enter two arrays of integers
and displays whether the two are strictly identical. Here are the sample runs.
3
*
3
Enter list1:
Enter list2:
The two arrays are strictly identical
51 22 25 6 1 4 24 54 6
51 22 25 6 1 4 24 54 6
Enter list1:
Enter list2:
The two arrays are not strictly identical
51 25 22 6 1 4 24 54 6
51 22 25 6 1 4 24 54 6
7.29
( Identical arrays ) The two-dimensional arrays m1 and m2 are identical if they have
the same contents. Write a method that returns true if m1 and m2 are identical,
using the following header:
public static boolean equals( int [][] m1, int [][] m2)
Write a test program that prompts the user to enter two lists of integers and dis-
plays whether the two are identical. Here are the sample runs.
Enter list1:
Enter list2:
The two arrays are identical
51 25 22 6 1 4 24 54 6
51 22 25 6 1 4 24 54 6
Enter list1:
Enter list2:
The two arrays are not identical
51 5 22 6 1 4 24 54 6
51 22 25 6 1 4 24 54 6
 
Search WWH ::




Custom Search