Create an manages a 2d array of ints

Assignment Help Computer Engineering
Reference no: EM132175589

Util2D creates an manages a 2d array of ints. It has a constructor that takes a 2d array as a parameter and assigns it to the instance variable. You write the whole class

Provide the constructor

Provide these methods

getSmallest() Gets the smallest integer in the array

numberOfEvenInColumn(int column) Gets the number of even integers in the specified column. Remember both positive and negative numbers can be even.

last() Gets the element in the last column of the last row

contains(int target) Returns true if the target is in the array, otherwise false.

Use the following file:

Util2DTester.java

/** * Tester for Util2D class. * * @author Kathleen O'Brien */ public class Util2DTester { public static void main(String[] args) { int[][] numbers = { {-5, 8, 6, 3, 11}, {3, -6, -2, 5, -9}, {1, 2, 5, 7, 6} }; Util2D util = new Util2D(numbers); System.out.println("Smallest: " + util.getSmallest()); System.out.println("Expected: -9"); System.out.println("Even in column#1: " + util.numberOfEvenInColumn(1)); System.out.println("Expected: 3"); System.out.println("Even in column#0: " + util.numberOfEvenInColumn(0)); System.out.println("Expected: 0"); System.out.println("Last: " + util.last()); System.out.println("Expected: 6"); System.out.println("Contains: " + util.contains(8)); System.out.println("Expected: true"); System.out.println("Contains: " + util.contains(15)); System.out.println("Expected: false"); int[][] numbers2 = { {5, 3, 2, 4}, {6, 1, 7, 8} }; util = new Util2D(numbers2); System.out.println("Smallest: " + util.getSmallest()); System.out.println("Expected: 1"); System.out.println("Last: " + util.last()); System.out.println("Expected: 8"); } }

Reference no: EM132175589

Questions Cloud

Basis for moral decision-justifying a course of action : What potential issues could arise when using a religious authority (for instance, the gods or God) as a basis for moral decision/justifying a course of action?
Review the problems of the coherent waves : Two coherent sources of radio waves, A and B, are 5.00 metersapart. Each source emits waves with wavelength 6.00 meters.
Show how the clock input is connected to the devices : Show how the clock input is connected to the devices. Draw the circuit clearly.
Contrast the functionalist and conflict perspectives : Contrast the functionalist and conflict perspectives on culture and explain three ways in which social networks in our society are changing due to the internet.
Create an manages a 2d array of ints : Creates an manages a 2d array of ints. It has a constructor that takes a 2d array as a parameter and assigns it to the instance variable.
Discuss two specific ways : Discuss two specific ways that technology is changing the face of the workplace.
Becoming more secularized or more fundamentalist : Do you believe the united states is becoming more secularized or more fundamentalist? comparing your generation to that of your parents or grandparents
Argue against striving for this form of equality : What is "equality of condition," and why did Thomas Malthus argue against striving for this form of equality?
Argument anticipate the free rider problem : Why, according to Adam Ferguson and John Miller, is inequality necessary? In what way does their argument anticipate the "free rider problem"?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Explain the levels of management hierarchy

There are three levels of management hierarchy: strategic, managerial and operational. Part 1: Review at least 4 academically reviewed articles on each.

  What are the features of a good access control system

what are the features of a good access control system? explain how access controls should be used and who should manage

  Write a paper will focus on issues with patch management

Write a paper will focus on issues with Patch Management. With the advent of many types of software and systems, patch management is major nightmare.

  Generate a database for the gps law firm

Generate a database for the GPS Law firm

  Draw the timing diagram for a digital signal

Draw the timing diagram for a digital signal that continuously alternates between 0.2 V (binary 0) for 2 ms and 4.4 V (binary 1) for 4 ms.

  Which gpo policy takes precedence in case of policy coflict

Which GPO policy takes precedence in the case of a policy conflict? Why? What is the value of the Group Policy in an enterprise environment?

  Prepare a five to eight pages paper on the six-step comptia

Prepare a five to eight pages paper on the six-step CompTIA A+ troubleshooting theory. The paper should be in APA Format style.

  Produce the collection of sets

COP 4020 Assignment cparse. Read in a start symbol of a set of productions followed by set of productions from stdin and produce collection of sets of LR(0)

  Discuss new information technology has a ripple effect

The introduction of new information technology has a ripple effect, raising new ethical, social, and political issues that must be dealt with on individual

  Express how to use the six steps of the psdlc

Each time you need to play a particular song, you have to manually search through the boxes to find the CD that has the song you need. It has become a habit that as individuals finish playing a CD, they would simply put it in the nearest box.

  Provide your friend with outcomes of any arrest records

As a convenience, should you provide your friend with outcomes of any arrest records of job applicants?

  Design a pi controller for the displacement of load element

The simple model of the system is shown above with a mass m in addition to the viscous damping b.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd