Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a public instance (not static) method called testVal) in TestUtil.java that returns an int. This method must take a single String parameter. This

image

Write a public instance (not static) method called testVal) in TestUtil.java that returns an int. This method must take a single String parameter. This method will possibly throw 3 Exceptions based on the string parameter as follows: If the parameter is null, the method must throw an NPE. If the parameter contains more than 20 characters, throw an IOException. Before you See class If the parameter is the value "critical", case insensitive, throw a CS2Exception. throw CS2Exception, you must set the problem attribute to the value "Critical Warning". definition for details. If the parameter is the value "good", case-insensitive, return 0. If the parameter is the value "warning", case-insensitive, return any negative number. If none of the criteria above applies, the method must return any positive number. CS2Exception is a class you will create. See the class diagram in the assignment on how to define. Also, there must be a private string attribute named problem. Create a properly named public setter and getter for this problem attribute.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Here is an example implementation of the TestUtil class in Java as per the given requirements java i... 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

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions