Menu

(Solved) : Java Write Method Check Prefix Two Strings 3 Characters 3 Char Prefix Word Class Cla Meth Q37164050 . . .

injava!!

Write a method to check prefix of two strings that have more than 3characters. A 3-char prefix of a word “class” will be “cla”. Themethod should take two strings as parameters, then compare 3-charprefix of two strings.

Write a method to check suffix of two strings that have more than 3characters. A 3-char suffix of a word “world” will be “rld”. Themethod should take two strings as parameters, then compare 3-charsuffix of two strings.

Detail requirements of the methods are below:

Requirements:

  1. UseScanner object to take strings input from console.

  2. Bothmethods should check the length of the input strings first. If anystring is less than 3 characters, the method should show “Stringtoo short, please re-enter.” And ask inputs again until bothstrings equal or more than 3 characters.

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

  4. Ifprefix or suffix does not match, it should show “3-char prefixdidn’t match” or “3-char suffix didn’t match”.

  5. Testyour methods with different inputs. Take screenshots for matchedresults, 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 “c…

OR