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

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 #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

Step: 3

blur-text-image

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

Students also viewed these Databases questions