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

  Own file to test your program

Create your own file to test your program. Your job is to set up the input and output files to have the program read from a file and write to a file. Here is a basic program that will accomplish what is desired

  Cascading style sheet to a website

Compare and contrast the process of adding JavaScript and a Cascading Style Sheet to a Website. Determine if they can be used simultaneously in a page.

  Object-oriented gui drawing editor

A simple object-oriented GUI drawing editor that allows a user to create, move and erase rectangles, squares, circles and lines in an interactive graphics. How can I draw move erase rectangles, squares, circles and lines in GUI/java.

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Vehicle in vehicle.java

Create a class called Vehicle in Vehicle.java with instance variables make (such as Ford, GM, Chrysler, Toyota, or Honda), year, and horsepower (200, 300, and 400). Add the necessary constructor and set and get methods.

  Write a program to register students for a college

Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method, public boolean register, which returns the boolean value of true or false if the student is successfully registered for the ..

  Design a program to help a videorental store

Design classes (class video, class customer, etc) based on your analysis above, using LINKED LISTS for the database elements read into the main memory.

  Public float usefulload()

public float usefulLoad() // this is the grossWeight - emptyWeight public float usefulLoadWithFuel( in gallons ) // this is the useful load - gallons x 6. The programmer user will pass in the number of gallons on board.

  Create and code a program that uses three parallel numeric

Create and code a program that uses three parallel numeric arrays of size 6. The program searches one of the arrays and then displays the corresponding values from the other two arrays.

  Client class to test implementation of the vector class

Write a client class to test your implementation of the Vector3D class thatyou implemented. Name the package in which this class is defined (projectname) vector3dapp.

  Write a program that asks a user for a file name and prints

Write a program that asks a user for a file name and prints the number of characters, words, and lines in that file.

  Create java program to find number of days left in that year

Create a Java program called "DaysLeftInYear.java" that outputs the number of days left in that year. use the calendar class to represent dates. Use the DateFormat class to display the current date in the output.

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