Question: In this lab assignment, you are expected to implement Tester.java, Operator.java, OperatorIgnoreException.java and OperatorHandleException.java files. Operator An interface that has the signatures of the following

In this lab assignment, you are expected to implement Tester.java, Operator.java,
OperatorIgnoreException.java and OperatorHandleException.java files.
Operator
An interface that has the signatures of the following methods.
- divide method: receives two double and returns a double.
- getElement method: receives an double array and a double value, returns an double.
- convertToInt method: receives a String and returns an integer.
OperatorIgnoreException
A class that implements Operator interface. Does not include any exception handling
property.
- divide: divides two double values. The first argument will be divided by the second
argument.
- getElement: The double argument is the index value. Its floor is the index of the
double to return.
- convertToInt: converts the String to an integer value and returns it.
OperatorHandleException
A class that implements Operator interface. The methods work the same way described in
the previous class. Additionally, it has exception handling behaviour.
- divide: ArithmeticException will be thrown in case of divide by zero. Catch that
exception and divide by 0.1 instead of 0.
- getElement: ArrayIndexOutOfBoundsException will be thrown if index exceeds the
boundaries of the array. Catch that exception and return the last element.
- convertToInt: NumberFormatException will be thrown if the string does not consist of
digits. Catch that exception and return an integer that only consist of digits in the string.
For example, for the string c123ab11, return 12311. If the string does not include any
digits, return 0.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!