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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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