Ask Java Expert


Home >> Java

Assignment

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 name's 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 file's 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 ThanForDecade_.txt, where is the name entered by the user and is the decade chosen by the user for this task.

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__Names_Decade_.txt, where is the number of names entered by the user and is the decade selected by the user. Note: as previously mentioned, because there are two names for most ranks, finding the top N names will usually find N*2 names.

4 -

In this task, the program will create a new file in the current folder that contains the results of applying criteria you came up with for this option. This option must do some processing on the input data based on at least one input from the user. Be sure to make it clear to the user what the program will do in this task. The Results should be written to a file in the current folder whose name identifies which task created the file.

5 - Exit program.

Attachment:- Names.rar

Java, Programming

  • Category:- Java
  • Reference No.:- M92295168
  • Price:- $170

Priced at Now at $170, Verified Solution

Have any Question?


Related Questions in Java

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As