top of page

Java Programming Solution.

As you become more experienced in programming, I cannot overemphasize the importance of checking for valid user input. For if there is any possible way that an application can be broken, I can guarantee you that the user will find that very oversight.

With that in mind, this assignment’s primary focus is on validation of user input using the Scanner object. For that, I want you to write two blocks of code within your main() method. The first block will check for a valid numerical (integer) value entered. The second block will check for a valid character value (A – H (uppercase)) entered (you may convert a lowercase character to uppercase).

Your code will incorporate a loop structure within each block of code that will iterate until valid input is obtained.

Write yet another block of code that checks for a valid string entered (Length > 0). One of the obstacles to overcome when checking for a valid string entry is to detect whether a user has entered a string of all spaces (which is length > 0). This additional block of code will also incorporate a loop structure that will iterate until valid input is obtained. 

Here is a sample run of the program:
Enter An Integer: b
Invalid Input. Enter An Integer: #
Invalid Input. Enter An Integer: 12345
You entered integer: 12345
Enter A Character <A - H>: x
Invalid Input. Enter A Character <A - H>: 2
Invalid Input. Enter A Character <A - H>: b
You entered character: B

Validations Java Assignment Solution

$30.00 Regular Price
$28.50Sale Price
    bottom of page