Question: 6.20 Lab 7b Due 11-30-17 Objectives Multidimensional arrays used to solve math formulas Create methods that have arrays as parameters and/or return value Background reading
6.20 Lab 7b Due 11-30-17
Objectives
Multidimensional arrays used to solve math formulas
Create methods that have arrays as parameters and/or return value
Background reading
ZyBooks Chapter 5, 6
Assignment
Write a class Lab7b that implements the following methods:
public static int[] getRow(int[][] a, int i) { // returns row number i out of the specified array a[][] // FIXME // check that i is within range of valid indexes for a, else return null // return row (this is a one-dimensional array) } public static int[][] copy(int[][] a) { // returns a copy of the specified array a[][] // Assume each row in `a` has the same number of columns // FIXME : make a new 2-D array the same dimensions as a // Row size is a.length. Column size is a[0].length // Fill the new array with contents of a // return the new array } public static boolean equals(int[][] a, int[][] b) { // returns false unless the two arrays have the same dimensions // and the same elements at each position // FIXME: // if a does not have same number of rows as b, return false // In a nested loop, check that a and b have same number of columns, else return false // check that each a[i][j] is same as b[i][j], else return false // return true if all is well } Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
