(Solved) : Write Program Named Substringtester Prompts User Enter Two Strings Uses Indexof Method Str Q44024213 . . .
Write a program namedSubstringTester which prompts the user to enter two strings anduses the “indexOf” method of the String class to report whether thesecond string is a substring of the first string.
Enclose the strings inquotes as shown in the sample output below. Be sure thatyour program accepts strings with embedded spaces.
Section 4.4.9 in thetext describes finding characters and substrings in a Java Stringand provides examples of using the indexOf method.
Note: You mustuse the “indexOf” method for your solution in order toreceive credit for this assignment. Yes, there are other methods toextract and test for substrings, but for this assignment this isthe method you need to use.
As always, follow theguidelines presented in the Programming Assignment rubric,including an ID header, descriptive comments, correct codealignment, and camelCase notation for multi-word variables.. Submitonly your .java file, do not submit a project, .class file, orprogram output.
You may submit anunlimited number of times up to the due date, but only your lastsubmission will be graded.
ExpectedOutput (user input is shown in red). Make sure your programproduces this output given the example user input. Feel free totest additional input values to thoroughly test yourprogram.
Please enter a string:quick brown fox
Please enter another string: brown fox
“brown fox” is a substring of “quick brown fox”
Please enter a string:quick brown fox
Please enter another string: red rabbit
“red rabbit” is not a substring of “quick brown fox”
Expert Answer
Answer to Write a program named SubstringTester which prompts the user to enter two strings and uses the “indexOf” method of the S…
OR