Answered step by step
Verified Expert Solution
Link Copied!

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions