Question: Write a Java class that obtains a String from the end user. Validate that it is between 5 and 25 characters long. If it isnt,

Write a Java class that obtains a String from the end user. Validate that it is between 5 and 25 characters long. If it isnt, display an error message. If it is, proceed and use the String class to generate the output below. The output will of course vary based on the value the user types in for the String.

Invalid length:

Type a string from 5 to 25 characters and press Enter: Hi

Error: length must be from 5 to 25 characters

Valid length:

Type a string from 5 to 25 characters and press Enter: MBachman@towson.edu

String length: 19 Uppercase: MBACHMAN@TOWSON.EDU Lowercase: mbachman@towson.edu Characters in the first five positions: MBach Character at the first position: M Position of the @: 8 Last four characters: .edu

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!