Please use loop and add comment on each line. Thank you Write down a method named: hasTwoConsecutiveLetters() in Java, to check if the input (argument) string has two consecutive occurrences of the same letter (alphabetic characters). The method should be case insensitive. Write a test program that prompts user to input a string and invokes this method. Here is the sample run. Example: Enter an input string: aabcded Output: The input string aabcded has two consecutive same letters Enter an input string: ababab Output: The input string ababab has no two consecutive same letters Enter an input string: abbbabab Output: The input string abbbabab has no two consecutive same letters [Note: In the case above we will not consider bbb as there are three consecutive b’s, we only need to find instances where there are only two consecutive letters]
Please use loop and add comment on each line. Thank you
Write down a method named: hasTwoConsecutiveLetters() in Java, to check if the input (argument) string has two consecutive occurrences of the same letter (alphabetic characters). The method should be case insensitive. Write a test program that prompts user to input a string and invokes this method. Here is the sample run.
Example: Enter an input string: aabcded Output: The input string aabcded has two consecutive same letters Enter an input string: ababab Output: The input string ababab has no two consecutive same letters Enter an input string: abbbabab Output: The input string abbbabab has no two consecutive same letters [Note: In the case above we will not consider bbb as there are three consecutive b’s, we only need to find instances where there are only two consecutive letters]
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images