Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Re-write Problem 2 to use a method that will produce the same output as Problem2. The program has a method called commonLetters. This method takes
Re-write Problem 2 to use a method that will produce the same output as Problem2. The program has a method called commonLetters. This method takes in two words (both are Strings) and returns a new String that contains the letters that both Strings contain in lower case (no duplicates). Hint: look at the String method indexOf(char). The method header is: public static String commonLetters (String str1, String str2) You will test your method in the main method of your program by using a Scanner object that will read in two Strings. Then call the method and pass the two Strings into the method and print the new String. Sample Input (2 Strings) Halifax Dartmouth Sample Output alhi Truro Toronto tro Happy dancing
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started