The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 401 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Write a java program that reads a sequence of names (first name followed by last name, separated by at least one space) from a text file and:
Displays the list of names (last name followed by a comma, followed by one space, followed by first name) that are read from the input file in ascending order. Each first name and last name must be capitalized (first letter in upper case and the remaining letters in lower case). First and last names must be lined up as per the example below.
******* All Names *********
Beres,             Kirsten
Beres,             Kirsten
Beumer,         Gretta
Hutt,              Colette
Hutt,              Shawanda
Jones,             Colette
Jones,             Marcia
Koenig,          Gerri
Means,           Tijuana
Montilla,        Adriana
Montilla,        Adriana
Montilla,        Adriana
Montilla,        Adriana
Mossman,       Emmanuel
Sapienza,        Colette
Sapienza,        Colette
Shover,           Neva
Stanfill,          Marcia
Your program must at least contain and use the following methods:
|
public static void getNames(ArrayList<String> fn, |
Prompts the user for the name |
|||
|
ArrayList<String> ln) throws IOException |
of an input file containing a list |
|||
| Â |
of first and last names as |
|||
| Â |
described above and reads the |
|||
| Â |
list of first and last names |
|||
| Â |
contained in the input file into |
|||
| Â |
ArrayLists fn and ln. |
 |  | |
| Â |
You can assume that the input |
|||
| Â |
file format is correct. |
 |  | |
|
public static void capitalize( |
Capitalizes all strings in names |
|||
|
ArrayList<String> names) |
 |  |  |  |
| Â | Â | Â | Â | Â |
|
public static void display( |
Displays |
content |
of |
the |
|
ArrayList<String> names) |
ArrayList names |
 |  | |
|
public static void writeToFile ( |
Prompts the user for the name |
|||
|
ArrayList<String> names) |
of an output file and writes the |
|||
|
throws IOException { |
contents of the ArrayList names |
|||
| Â |
into the output file. |
 |  | |
|
public static int find |
Looks for s in a. If s is found at |
|||
|
(String s, ArrayList<String> a) |
a position j of a, returns j. |
|||
| Â |
Otherwise returns -1. |
 |  | |
|
public static void |
Sorts ArrayList names |
 |  | |
|
sort(ArrayList<String> names) |
||||
Â
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll