Menu

[Solved]Java Write Method Check Prefix Two Strings 3 Characters 3 Char Prefix Word Class Cla Meth Q37114297

In Java!!

Write a method to check prefix of two strings that have morethan 3 characters. A 3-char prefix of a word “class” will be “cla”.The method should take two strings as parameters, then compare3-char prefix of two strings.

Write a method to check suffix of two strings that have morethan 3 characters. A 3-char suffix of a word “world” will be “rld”.The method should take two strings as parameters, then compare3-char suffix of two strings.

Detail requirements of the methods are below:

Requirements:

  1. Use Scanner object to take strings input from console.

  2. Both methods should check the length of the input strings first.If any string is less than 3 characters, the method should show“String too short, please re-enter.” And ask inputs again untilboth strings equal or more than 3 characters.

  3. If prefix or suffix matches, it should show “3-char prefixmatched” or “3-char suffix matched”, and also show the matched 3characters.

  4. If prefix or suffix does not match, it should show “3-charprefix didn’t match” or “3-char suffix didn’t match”.

  5. Test your methods with different inputs. Take screenshots formatched results, and not-matched results.

Expert Answer


Answer to In Java!! Write a method to check prefix of two strings that have more than 3 characters. A 3-char prefix of a word “… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *