Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab 2 interface Java Code Description: We have begun to look at objects as a tool we can build and utilize in our applications; now
Lab 2 interface
Java Code
Description: We have begun to look at objects as a tool we can build and utilize in our applications; now let's build a class/object that contains a 2-dimensional array and restrict access through our methods. This object will allow for multiple types of calculations to be performed, but at no point will it allow any direct changes to our 2-dim array class variable! Essentially, once it is created, it cannot be changed. Program Specifications: 1. An interface title Lab2Interface* has been provided for you to implement in your Lab2 class. Additionally, some JavaDoc has been written for you (it may be incomplete) to describe how the various methods should be implemented. Please feel free to add to or modify the format of the JavaDoc (without changing the content of course... .no making things easier!) All of the methods that accept input (except the constructor which is a special kind of method) should throw a generic exception if an invalid input is provided. Make sure you are testing this behavior in your JUnit test class; each method should have at least 2 tests associated with it, one that tests throwing an exception and one that does not. 2. Packaging: Fully qualified class names are listed below: (Note: the bold is the class itself) edu.ben.labs.lab2.Lab2 edu.ben.labs.lab2.Lab2lnterface package edu.ben.labs. lab2; public interface Lab2Interface Accepts a two dimensional array upon construction to allow for to be run against it (Methods contained in class). operations Cparam array Array to use for any future calculations (methods in class) Note: this is the required constructor, but constructors are NOT * interfaces. Therefore, this has been included merely for you to know * is the expected constructor and that you should implement it! part of this // public Lab2(int][ array); Returns the total of all values in the array. * @return total of all values in array double getTotal) throws Exception; * Returns the average of all values in the array. *@return int getAverag) throws Exception; Accepts integer value representing the row. eacan row Row number to total (0...i-1) * @return Returns the sum of the values in the specified row nt.astRAMTotaALint row) throws Exception ; Accepts integer value representing the column. k Cpacam co *@return Returns the sum of the values in the specified column Column number to total (0..j-1) int getcolumototallint col) throws Exception; Accepts integer value representing the row. *eRAAR row Row number to use for determining highest value (0...i-1) * Creturn Returns the highest integer value in the row. iat getHiabestLnBolint row) throws Exception; Accepts integer value representing the column *paca co *ereturn Returns the highest integer value in the column int getHigbestlocelunLint col) throws Exception; Column number to use for determining highest value o..j-1)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started