Question: Write a class named InputChecker that has the following methods, including checking for exceptions where necessary: 1) A method named isLetterString that accepts a String

Write a class named InputChecker that has the following methods, including checking for exceptions where necessary:

1) A method named isLetterString that accepts a String parameter and returns a boolean. The method will return true if the String's length is at least one and it contains only letters (both upper and lowercase are acceptable) and false otherwise. The char values for uppercase letters are 65 through 90 and for lowercase letters are 97 through 122. When checking the String contents, the method will catch a NullPointerException and return false.

2) A method named hasValidFormat that accepts a String parameter and returns a boolean. The format will be valid if the String contains a period character ('.'), has at least one letter character before the period, and has exactly three letter characters after the period. Other than the period, a String with valid format will only have letter characters. This method will call isLetterString twice, first sending the portion of the String before the period, then the portion after the period. If either call to isLetterString returns false, this method will return false.

3) A method named isShortString that accepts a String parameter and returns a boolean. The method returns true if the String is less than or equal to 16 characters long and throws an Exception back to the method caller if the String is more than 16 characters long. When checking the String length, the method will catch a NullPointerException and return false

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 General Management Questions!