Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and implement a Java application (CountNames.java) that reads an unspecified number of names and finds the one that has the most occurrences (case insensitive).

image text in transcribed

image text in transcribed

Design and implement a Java application (CountNames.java) that reads an unspecified number of names and finds the one that has the most occurrences (case insensitive). The input ends when the user enters zero. If not one but several names have the most occurrences, all of them should be reported. Here are some sample outputs: Sample #1: Please enter a name: John Please enter a name: James Please enter a name: john Please enter a name: John Please enter a name: 0 john repeated most Sample #2: Please enter a name: John Please enter a name: john Please enter a name: james Please enter a name: james Please enter a name: jack Please enter a name: 0 john repeated most james repeated most Sample #2: Please enter a name: John Please enter a name: john Please enter a name: james Please enter a name: james Please enter a name: jack Please enter a name: 0 john repeated most james repeated most Sample #3: Please enter a name: 0 No name is entered! A few notes: Hint #1: Use a map to store the repetition of each name. (Key: Name, Value: Number of Repetition) Hint #2: You can use the values() method from the Collection interface to return values as a Collection object. Hint #3: You can use the keySet() method from the Map interface to returns all keys as a Set object

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

1. What would you do if you were Jennifer, and why?

Answered: 1 week ago

Question

Finding and scheduling appointments with new prospective clients.

Answered: 1 week ago