Question: To start, make an input box like the one in the screenshot. Afterwards, we will make some verification checks on the input (a) Verify that
To start, make an input box like the one in the screenshot. Afterwards, we will make some verification checks on the input (a) Verify that when the user hits cancel, null is returned with print statement (b) Now that the null is verified, add a check for it. Using an if statement to test for a null value and, if there is a null value, display a JOptionPane message box informing the user the input was null. You may comment our print statement from (a) using // or /* */. (c) Inside the null checking if statement from part b, include the statement System.exit(0); This statement ends the program execution if the input is null! (d) Verify that clicking ok without putting any input into the input box returns the empty string. You should use the equals() method for strings to do this. Use an if statement like in part b. (e) Combine the if statements from b and d using logical operators. The if statement should check to see if the input is empty or null, use a JOption message box to inform the user of improper input, and then exit using System.exit(0); Do not delete the code from parts b and d; just comment it out using // or /* */
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
