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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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