Write a java program that will read a sequence of names

Assignment Help JAVA Programming
Reference no: EM13166202

Write a java program that will read a sequence of names (first name followed by last name, separated by at least one space) from a text file and will 1) remove all duplicate names and 2) write the names (last name followed by a comma, followed by one space, followed by first name) in ascending order to a text file.

 

For example, if the input file contains:

Colette Sapienza

Gretta Beumer

Emmanuel Mossman

Colette Sapienza

Shawanda Hutt

Adriana Montilla

Adriana Montilla

Adriana Montilla

Marica Stanfill

Neva Shover

Tijuana Means

Adriana Montilla

Gerri Koenig

Kirsten Beres

Kirsten Beres

The output file must contain:

Beres, Kirsten

Beumer, Gretta

Hutt, Shawanda

Koenig, Gerri

Means, Tijuana

Montilla, Adriana

Mossman, Emmanuel

Sapienza, Colette

Shover, Neva

Stanfill, Marica

Your program must contain and use the following methods:

public static int find

 

      (ArrayList<String> names, int i)

 

Let s be names.get(i);

 

Looks for s beginning from position i+1. If s is found at a position j (j > i), return j. Otherwise return -1.

 

  public static void

   removeDuplicates(ArrayList<String> names)

 

Removes duplicates from ArrayList names

 

public static void

 

      sort(ArrayList<String> names)

 

Sorts ArrayList names

You cannot use ArrayList’s sort method.

The main method must:

1.      Prompt the user for the name of the input file with a meaningful message.

2.      Prompt the user for the name of the output file with a meaningful message.

Reference no: EM13166202

Questions Cloud

What is the approximate ph after adding the sodium acetate : If you are given sodium acetate and asked to make a .5 M acetate buffer at pH 4.75, will you have to add acid, base, or nothing in order to achieve the proper pH? What is the approximate pH after adding the sodium acetate?
Consider the standard heats of formation : Consider the following standard heats of formation: Standard Heat of formations for the substances:CO2(g) = -393.5 kJ/mol PbO(s) = -151.6 kJ/mol CO(g)
Before each sort, write psudo-code : Ceate a single cpp ?le (FILE=MAIN2.cpp) containing all three elementry sorts(bubble, insertion, selection). Before each sort, write psudo-code and invarient analysis of the sort in block comment style. Add the code from 3.). Generate a list of 100..
How much potassium nitrate will perciapitate : A supersaturated solution of potassium nitrate is formed by adding 150 g KNO3 to 100 g water, heating until the solute completely dissolves is agitated, how much potassium nitrate will perciapitate.
Write a java program that will read a sequence of names : Write a java program that will read a sequence of names (first name followed by last name, separated by at least one space) from a text file and will 1) remove all duplicate names and 2) write the names (last name followed by a comma, followed by one..
Compute the change in entropy for the reaction : Calculate the change in entropy (in J/K) for the following reaction at 298 K: C(s) + H2O(g) ? CO(g) + H2(g) Use entropy for graphite (diamond is too expensive).
Parent handle a troublesome child : If you are a parent, describe one of your favorite and most effective parenting “tricks” and how it achieves its goal. If you are not a parent, describe how you might have seen another parent handle a troublesome child.
Write the complete chemical formula for the unknown compound : Measurements also show that a certain sample of the unknown compound contains 9.8 mol of oxygen and 3.31 mol of chromium.
Pessimistic conclusion : What figure understood the human will in light of his pessimistic conclu sion that “life is given us, not to be enjoyed, but to be overcome”?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Palindrome is a sequence of char that reads backward forwrd

A palindrome is a sequence of characters that reads the same backward as forward. For example, each of the following five-digit integers is a palindrome: 12321, 55555, 45554, and 11611. Write an application called Palindrome.java that asks the user t..

  Menu based program to maintain student records

Write a menu based program to maintain student records. Your program should take the following inputs: 1. Student first name (max. 20 characters) 2. Student last name, (max. 20 characters) 3. Student scores (float/double), eg. 85.4 Problem

  Develop a graphical user interface based java program

Develop a Java program that can communicate with a real SMTP email server for sending emails. TNE 60003 - introduction to network programming, You program should provide a GUI and can successfully send the SMTP commands to the mail server

  The objective is to implement a menu-based system

The objective is to implement a menu-based system for Bank Accounts in order to simulate a very simple banking system. Many structures have to be declared to manage bank accounts.

  Robot preparing for competition

Create an event so that the skateboard can be controlled by game player

  Create an application for disney''s cottages

Create an application for Disney's Cottages, a weekend getaway resort that rents cottages and boats to use on the local lake

  Write a program that simulate n rolls of six-sided die

Write a program that simulate n rolls of six-sided die and displays the frequency of occurrence of each side and What is the most likely method signature of the "parseInt() - TNE60003

  Java servlet uses doget to return markup document

Write down Java servlet which uses doGet to return markup document which provides your name, e-mail address, and mailing address along with a brief autobiography.

  Client server monitoring system project design

client server monitoring system project design. The server adminstation can send messages to the clients and DESIGN WITH JAVA NETBEANS AND GUI.

  Elliptic curve encryption

write a program to implement Elliptic Curve encryption/decryption and program will read parameters, plaintext and ciphertextfrom a file named "input.txt" (under the same directory).

  Write a void function this passed three integers

1. Write a void function this passed three integers by reference. The function should rearrange the parameter values so that the first parameter will get the smallest value; the second parameter the middle value; and the third parameter the largest v..

  Record managing system application

Build a student record managing system application

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd