Question: . Please write a program that accepts hexadecimal strings containing exactly four hexadecimal digits. Hexadecimal digits are 0.9 and A, B, C, D, E, F

 . Please write a program that accepts hexadecimal strings containing exactly

. Please write a program that accepts hexadecimal strings containing exactly four hexadecimal digits. Hexadecimal digits are 0.9 and A, B, C, D, E, F 16 in total. (The input is not case sensitive, so, e.g., ABCD, aBCd, and abcd are all valid.) Examples of valid inputs: 0000, 0001, 0012, 0123, 1234, 000A, 000B, 000C, 00AB, 0ABC, FFFF, A123, ABCD, E000, FFOF, F00D, BEAD, CAFE, FACE, FADE, FEED, etc. Examples of invalid inputs: 0, 1, 12, 123, A, B, C, D, E, F, AB, ABC, FF, FFF, 00000, OFOFO, FFFFF, EFG, EFGH, Hello, When the user wants to stop entering numbers, the user wll enter BYE (it's not case-sensitive so bye and Bye, for example, are both ok) Here are the steps: Step 1: Prompt the user and read the string input by the user. Step 2: Validate the input If the string entered has four characters - continue with step 3. Else if the string typed was "BYE" (not case sensitive) exit the program. Else an invalid input was entered - display an error message and tell the user to try again go back to Step 1 Step 3: Check that the four characters are valid hex digits-use charAt() to check one digit at a time. If at least one digit is invalid, display an error message and tell the user to try again go back to Step 1. A hint for this Java program is provided in the Resources tab on NYU Classes in file: HexUtility.java Fill in the TBDs

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