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.
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”?
|