Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the above UML diagram in Java. As a instance variable, there is a 2d array called array2d. In the constructor(2 points), get the row

image text in transcribedImplement the above UML diagram in Java. As a instance variable, there is a 2d array called "array2d". In the constructor(2 points), get the row and column number, initialize the array accordingly. Using the fillArray method(2 points), add random elements to this 2d array (use 0-10 range). The getColumn method(3 points), returns a 1d array back containing the elements of the given column in array2d in the same order as they appear in this array2d. Make sure that the given column is valid for array2d. isEquivalent method(8 points) returns true only if every value in first array(first argument for this method) appears in the second array (second argument for this method). hasDuplicates method(5 points) returns true if there are any duplicate values in the given array, false otherwise. isPerfect method (10 points) returns true if array2d is a perfect array. A 2d array is perfect if: the first row has no duplicates all the first row elements also appear in each row of this array too all the first row elements also appear in each column of this array too Make sure that the given 2d array has equal number of rows and columns and has at least one row Example: int [][] array2d = { {1,2,3}, {4,5,6}, {7,8,9}} array2d.getColumn(2) should return {2,5,8} Examples of perfect array: { {1,2,3},{2,3,1},{3,1,2} } { {10,20,30,40},{40,30,20,10},{30,40,10,20} ,{20,10,40,30}} Examples of non-perfect array: { {1,2,1},{2,1,1},{1,1,2} } { {1,2},{1,2} } { {1,2,3},{3,1,2},{4,5,6} }

FinalExam array2d: int[10 + FinalExam(int,int) fillArray(int[0) : void + getColumn(int[]0),int): int[] + is Equivalent(int[], int(l): boolean + hasDuplicates(int[]): boolean + isPerfect(int[0]): boolean

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

List the techniques available for carrying out methods analysis.

Answered: 1 week ago

Question

=+How do banks mitigate these problems?

Answered: 1 week ago