Question
(Count the occurrences of names entered using Java programming language) A. Write a program that reads an unspecified number of names and finds the one
(Count the occurrences of names entered using Java programming language)
A. Write a program that reads an unspecified number of names and finds the one that has the most occurrences. The input ends when the input is EXIT. For example, if you entered
Mike Amelia William Amelia Lucas Amelia Henry Amelia Amelia Mike EXIT,
the name Amelia occurred most often. If not one but several names have the most occurrences, all of them should be reported. For example, since Mike and Amelia appear twice in the list Mike Amelia William Amelia Mike both occurrences should be reported.
B. Rewrite the program in A to display the names in ascending. (Hint: use a TreeMap)
Main purpose: Learn how to use basics of Java Collections Framework
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