JAVA Write a program that prompts the user to enter a line of text and displays the letter that has the most occurrences with the number of occurrences. For example, if “I ate an apple.” was entered, the letter ‘a’ occurred the most often. If not one but several letters have the most occurrences, all of them should be reported. For example, since ‘o’ and ‘t’ appear three times in “I went to the zoo.”, both occurrences should be reported. Sample Run: Enter a line of text: I ate an apple. The following letter(s) occurred most [3 time(s)]: a Enter a line of text: I went to the zoo. The following letter(s) occurred most [3 time(s)]: o t Write the program allowing the user to input a string. If the user inputs a capitalized letter within the string, such as ‘A’, have the program change all capitalized letters to lowercase. This program should display the letter that has the most occurrences with the number of occurrences.
JAVA
Write a
For example, if “I ate an apple.” was entered, the letter ‘a’ occurred the most often.
If not one but several letters have the most occurrences, all of them should be reported.
For example, since ‘o’ and ‘t’ appear three times in “I went to the zoo.”, both occurrences should be reported.
Sample Run:
Enter a line of text: I ate an apple.
The following letter(s) occurred most [3 time(s)]: a
Enter a line of text: I went to the zoo.
The following letter(s) occurred most [3 time(s)]: o t
Write the program allowing the user to input a string.
If the user inputs a capitalized letter within the string, such as ‘A’, have the program change all capitalized letters to lowercase.
This program should display the letter that has the most occurrences with the number of occurrences.
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 3 images