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

Write a public instance (not static) method called testVal) in TestUtil.java that

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

1 Expert Approved Answer
Step: 1 Unlock

Here is an example implementation of the TestUtil class in Java as per the given requirements java i... View full answer

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 Programming Questions!