Write an application named Names.java that presents the user with a menu of tasks and continues reading a user selection and performing tasks until the user enters the selection for terminating the application. This application will do four tasks related to processing the file names.txt which gives boys and girls names and their popularity rankings for 11 decades beginning in 1900. In this file a popularity of zero indicates a ranking that was 1000 or more. Each line of the file contains one name at the beginning followed by 11 integers. The integers are the popularity ranks for the name at the beginning of the line. The first integer is the rank for the decade 1900-1910; the second integer is the rank for the decade 1910-1920 etc. This file format can be assumed to hold for every line of the file.
The application must begin by calling a method to read the entire file and load its contents into two parallel arrays one string array of names and one two-dimensional array of integers. The index for a particular name will also index that names popularity rankings in the two-dimensional array of integers.You should read the file a line at a time using a string Scanner on that line to store the name into the string array and the 11 integers into the corresponding row of the two-dimensional array of integers rankings. The file format and the two parallel arrays were discussed in the classroom when these requirements were distributed.Once the files data is loaded into the arrays present to the user the menu of tasks from which to choose: 1 – Have names ordered by increasing in length
In this task the program will create a new file in the current folder that contains all the same data as
names.txt but has the names ordered by increasing length: all names of length 1 in alphabetical order followed by all names of length 2 in alphabetical order followed all names of length 3 etc. The new file should be named ByNameLength.txt. This task should also display to the console the number of each name length found as it processes the new file and displays the final count of names and the new file name to the console upon completion. See the example execution log for details on the format of the console display. See Example output file for details on the format of file contents.
2 – Names better than a given name
In this task the program will create a new file in the current folder that contains all names with a better ranking than the name entered by the user in the decade also entered by the user. This task must prompt the user for that name and the decade of interest. If the name is not found display an appropriate error message and keep prompting for a name. Rankings are better if the popularity rank for that name in the same decade is less than the rank for the entered name and decade (but NOT equal to zero). Note: that if the entered name has a rank of R for the given decade then the program may find up to (R-1)*2 names with a better rank. For most ranks in each decade there are two names: one typically male and one typically female. The header line of this file states information about the name and decide entered and the last line summarizes the total names found. Use the exact format shown in the example output files. The new file created by this task must be named Name Better Than
3 – Top N names for a given decade
In this task the program will create a new file in the current folder that contains the top N names in a specified decade. The user must be prompted to enter the value for N and the particular decade. The file should contain the names ordered by increasing rank value: the two names with rank 1 then the two names with rank 2 then rank 3 etc. The appropriate header and closing lines should also be written. Use the exact format shown in the example output files. The new file created by this task must beTop_
4 –
5 – Exit program
This causes the application to terminate after displaying the total number of files created by the application for the user on this run of the program. (Note: selecting the first choice counts as one file no matter how many times the user selects it during the run.)