Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Modify the Numbers.java file to implement the proper exception handling and add the correct processing. Create a new exception, StringNotANumberException. Your NumberTester should catch this

Modify the Numbers.java file to implement the proper exception handling and add the correct processing. Create a new exception, StringNotANumberException. Your NumberTester should catch this exception and determine which string is not a number and pass 0 back to the add method for it. If both strings are not a number, the sum should be 0. Your number tester should print the sum of each call. Your NumberTester must pass both String and int arguments to the Number class so that your exception will be exercised.

Hints: Use a string when you throw your StringNotANumberException to help you determine which parameter is not a number. Add a method that will loop around your call to add() until you have valid values.

Example output:

15 + 10 = 25

First is invalid

a + 10 = 10

First is invalid

Second is invalid

a + b = 0

Second is invalid

15 + b = 15

Submit the files StringNotANumberException.java, NumbersTester.java and Numbers.java

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students explore these related Databases questions

Question

Answered: 1 week ago

Answered: 3 weeks ago

Question

5. Benchmark current training practices.

Answered: 3 weeks ago