The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
1. Write a JAVA class named Strict that has the method equals as specified in the book on page 316
(ALL CORRESPONDING ELEMENTS ARE THE SAME.)
2. The class named Strict should also have a method
public static int howmany(int[][] m1, int[][] m2) that returns how many cell values are identical
in the two arrays (it only counts if they are identical in the same cell.)
3. The class named Strict should also have a method
public static int diagonal(int[][] m1, int[][] m2) that returns how many cell values are identical
along the diagonal (that is, checking only cells [0][0], [1][1], and [2][2] from the two arrays.)
4. The class named Strict should also have a method
public static double average(int[][] m1,int[][] m2)that returns the average of all the cell values
from the arrays (one answer--DIVIDING BY 18.)
5. The class named Strict should also have a method
public static void display(int[][] m1, int[][] m2) that displays only those values of the arrays that
are odd in rectangular form (row by row for each array.)
You may assume the values entered are between 0 and 99 for formatting purposes. Make it pretty!
6. The class named Strict should also have a method
public static boolean silly(int[][] m1, int[][] m2) that returns true if the two arrays have all numbers satisfying
1 < numbers <=10 and returns false otherwise.
Write a public class named your IdenticalArrays that permits the user to provide sample input like in the
textbook and then displays the results of equals, howmany, diagonal , average (2 digits after
the decimal point), display, and silly. Skip one line after the answer for each method is printed.
DO NOT ASK FOR 18 PROMPTS. ENTER ALL THE NUMBERS AT ONCE AND USE NESTED FOR LOOPS TO PROCESS.
Both classes should be in the same file.
Â
316Chapter 8Multidimensional Arrays8.28(Strictly identical arrays) The two-dimensional arraysm1andm2arestrictlyidenticalif their corresponding elements are equal. Write a method that returnstrueifm1andm2are strictly identical, using the following header:public static booleanequals(int[][] m1,int[][] m2)Writeatestprogramthatpromptstheusertoentertwo3*3 arrays ofintegers and displays whether the two are strictly identical. Here are thesample runs.Enter a 3-by-3 matrix row by row:0.15 0.875 0.3750.55 0.005 0.2250.30 0.12 0.4The column-sorted array is0.15 0.0050 0.2250.30.120.3750.55 0.8750.4Write a test program that prompts the user to enter a 3*3 matrix of doublevalues and displays a new column-sorted matrix. Here is a sample run:Enter list1: 51 22 25 6 1 4 24 54 6Enter list2: 51 22 25 6 1 4 24 54 6The two arrays are strictly identical8.29(Identical arrays) The two-dimensional arraysm1andm2areidenticalif theyhave the same contents. Write a method that returnstrueifm1andm2are iden-tical, using the following header:public static booleanequals(int[][] m1,int[][] m2)Write a test program that prompts the user to enter two 3*3 arrays of integersand displays whether the two are identical. Here are the sample runs.Enter list1: 51 25 22 6 1 4 24 54 6Enter list2: 51 22 25 6 1 4 24 54 6The two arrays are not strictly identicalEnter list1: 51 5 22 6 1 4 24 54 6Enter list2: 51 22 25 6 1 4 24 54 6The two arrays are not identicalEnter list1: 51 25 22 6 1 4 24 54 6Enter list2: 51 22 25 6 1 4 24 54 6The two arrays are identical
Attachments: