Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 instead of
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 cab return If the string does not include any
digits, return
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