Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a (JAVA) program that reads the contents of the two files into two separate arrays. The user should be able to enter a name

Write a (JAVA) program that reads the contents of the two files into two separate arrays. The user should be able to enter a name the application will display messages indicating whether the names were among the most popular.

1. GirlNames.txt and BoyNames.txt contain a list of the 200 most popular names given to girls/boys born in the United States for the years 2000 through 2009.

2. Your application should use an array to hold the names.

3. The program should continue interacting with the user indefinitely unless the user chooses to quit by entering "QUIT" (should be case insensitive).

4. The user should enter a single name and the program will search the name in both lists. The user SHOULD NOT specify whether the search is for girls name or boys name. The program is responsible for finding either or both and telling the user where it found it.

5. The program should display one of the following four results (examples):

* The name 'Annabelle' was not found in either list.

* The name 'Xavier' was found in popular boy names list (line 81).

* The name 'Amanda' was found in popular girl names list (line 63).

* The name 'Jordan' was found in both lists: boy names (line 38) and girl names (line 75).

6. The search should be case insensitive, but the resulting message should always display names in properly capitalized format (the first letter uppercase all others lowercase).

7. The files should only be opened/loaded and closed once per program session (at the beginning of the program execution). During the search the files should be closed.

8. If any or both of the files are missing, display a message to the user informing which file is missing or if both files are missing and exit the program.

9. Your program should contain properly defined and used methods. For example, your program should have a method that loads a file into an array. This method should take one parameter for the file name to be loaded and return an array of Strings. Another method should take a name and an array reference and perform a search and return results to the calling method.

10. Do not upload input text files.

Required Output

Enter a name to search or type QUIT to exit: The name 'Annabelle' was not found in either list. Enter a name to search or type QUIT to exit: The name 'Xavier' was found in popular boy names list (line 81). Enter a name to search or type QUIT to exit: The name 'Amanda' was found in popular girl names list (line 63). Enter a name to search or type QUIT to exit: The name 'Jordan' was found in both lists: boy names (line 38) and girl names (line 75). Enter a name to search or type QUIT to exit: 

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

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

Enhance the basic quality of your voice.

Answered: 1 week ago

Question

Describe the features of and process used by a writing team.

Answered: 1 week ago