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

  Consider an array of integers

Consider an array of integers as below: int[] a = {5, 2, -4, 3, 0, -5, 7, 11, 6, 13} Complete the method named count(int[] a) in the class Count. The method should return the number of positive numbers in the array

  Java application to permit user to enter ten numbers

Write down Java application which permits a user to enter 10 numbers (double precision) into the array and then sorts and displays numbers from lowest to highest.

  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.

  Program that prompts the user to enter the year and display

Write a program that prompts the user to enter the the year and first day of the year and displays the calendar table for the year on the console. For example , if the user entered the year 2013, and 2 for tuesday, January 1, 2013, your program shoul..

  Java method for radix sort in binary

java method for radix sort in binary but I want to understand how to do it so please make it as simple as possible

  Java enumeration lettergrade represent letter grades

Write a java enumeration LetterGrade that represents letter grades A through F, including plus and minus grades. Define a private instance variable holding a boolean value.

  It should have an if statement

The following are hints given: It should have an if statement. This add method determines what number greater than or less than the other number, than it adds the positive or negative. I think this should be a private method.

  Implementation of memory management

Implementation of memory management

  Java class, array, link list , generic class

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

  Distance traveled modification

Distance Traveled Modification

  A method that takes a two-dimensional array

A method that takes a two-dimensional array of int's as a parameter and searches the array for the second parameter, returning true if the second parameter matches any of the integers in the array, and false otherwise.

  Create java application-input miles driven and gallons used

Create Java application which will input miles driven and gallons used (both as integers) for each tankful. Program must compute and display miles per gallon obtained for each tankful.

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