Question: Write a Java program which takes a string as a user input. Create 2 functions. The first function expects a string as argument and returns
Write a Java program which takes a string as a user input. Create 2 functions.
The first function expects a string as argument and returns void. It converts all upper case characters to lower case and converts all lower case characters to upper case. It then prints out the converted string to a console.
The second function also expects a string as argument and returns void. It will find first charactor that is repeated exactly 2 times in the string. The function then prints out the character to screen.
Example:
Enter a string: Hello World
Convert string: hELLO wORLD
The first character that duplicate 2 times is: o
Enter a string: Welcome to JaVa Class
Convert string: wELCOME TO jAvA cLASS
The first character that duplicate 2 times is: e
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
