Java Reference
In-Depth Information
Write a test program that prompts the user to enter a 3
3 matrix of double
values and displays a new column-sorted matrix. Here is a sample run:
*
Enter a 3-by-3 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
8.28
(
Strictly identical arrays
) The two-dimensional arrays
m1
and
m2
are
strictly
identical
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 3
3 arrays of
integers and displays whether the two are strictly identical. Here are the
sample runs.
*
Enter list1: 51 22 25 6 1 4 24 54 6
Enter list2: 51 22 25 6 1 4 24 54 6
The two arrays are strictly identical
Enter list1: 51 25 22 6 1 4 24 54 6
Enter list2: 51 22 25 6 1 4 24 54 6
The two arrays are not strictly identical
8.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 iden-
tical, using the following header:
public static boolean
equals(
int
[][] m1,
int
[][] m2)
Write a test program that prompts the user to enter two 3
3 arrays of integers
and displays whether the two are identical. Here are the sample runs.
*
Enter list1: 51 25 22 6 1 4 24 54 6
Enter list2: 51 22 25 6 1 4 24 54 6
The two arrays are identical
Enter list1: 51 5 22 6 1 4 24 54 6
Enter list2: 51 22 25 6 1 4 24 54 6
The two arrays are not identical
Search WWH ::
Custom Search