Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Programming The purpose of this project is to gain an understanding of using a hash table, sorting and basic report generation techniques. You will

Java Programming

The purpose of this project is to gain an understanding of using a hash table, sorting and basic report generation techniques.

You will be provided an input file with each line containing a persons first name, last name, and zip code separated by commas.

Instruction:

Create a hash map.

Read each line from the input file.

Parse the data into a Person class instance containing firstName, lastName, zipCode. If the parsing is not correct list that line as in error. Hint: there are standard Java library methods to help with the parsing.

Add the Person to the hash map. If a person by the same first and last name already exists, display an error and ignore this entry.

Sort the entries in the hash map by zip code, last name, and then first name. Hint: a HashMap does not support sorting. You will need to make a copy of all entries in the HashMap into another data structure.

Print a report header.

Print out the results sorted by zip code with a count of the numbers in each zip code.

Print a report summary.

Example of output:

A few sample lines in the input file might be:

Alan,Fontanella,55101

Bryan,Hills,40218

Andrew,Luck,55101

Joe,Smith,55102

Bill,Gates

Andrew,Luck,55102

For this input file, the generated report should look like:

Format error on line 5: Bill,Gates

Entry on line 6 already encountered: Andrew,Luck,55102

Company Zip Code Distribution April 6, 2018

Zip Code: 40218

Hills, Bryan

Zip Code 40218: 1 resident

Zip Code: 55101

Fontanella, Alan

Luck, Andrew

Zip Code 55101: 2 residents

Zip Code: 55102

Smith, Joe

Zip Code 55102: 1 resident

Report Summary:

2 Records in error

3 Zip Codes encountered

4 Records Processed

Input file:

Alan,Fontanella,55101 Bryan,Hills,40218 Andrew,Luck,55101 Rob,Ehrlich,55118 Joe,Smith,55102 Ada,Friedman,55404 Lucia,Friedman,55404 Owen,Friedman,55404 Kyra,Axner,55408 Bill,Gates,55417 Emil,Kraepelin,55408 Abraham,Lincoln,55467 Isaac,Newton,55404 Albert,Einstein,55455 Neils,Bohr,55414 Charles,Darwin,55455 Louis,Pasteur,55404 Sigmund,Freud,55408 Galileo,Galilei,55478 Antoine,Laurent,55478 Johannes,Kepler,55488 Nicolaus,Copernicus,55404 Michael,Faraday,55414 James,Clerk,Maxwell,55488 Claude,Bernard,55488 Franz,Boas,55455 Werner,Heisenberg,55478 Linus,Pauling,55404 Rudolf,Virchow,55408 Erwin,Schrodinger,55478 Ernest,Rutherford,55488 Paul,Dirac,55414 Robe,Hrlich,55118 Andreas,Vesalius,90002 Ycho,Brahe,55404 Comte,De-Buffon,55478 Ludwig,Boltzmann,55408 Max,Planck,55455 Marie,Curie,55478 William,Herschel,55404 Charles,Lyell,55488 Pierre,De-Laplace,90002 Edwin,Hubble,55455 Joseph,Thomson,55488 Max,Born,55408 Francis,Crick,55478 Enrico,Fermi,90002 Leonard,Euler,55488 Justus,Liebig,55455 Arthur,Eddington,55478 William,Harvey,90002 Marcello,Malpighi,55455 Christiaan,Huygens,55478 Karl,Gauss,55414 Albrecht,Haller,55408 August,Kekule,55478 Robert,Koch,55408 Murray,Gell-Mann,90029 Emil,Fischer,55414 Dmitri,Mendeleev,90029 Sheldon,Glashow,60617 James,Watson,60617 John,Bardeen,55414 John,Von-Neumann,90029 Richard,Feynman,55478 Alfred,Wegener,55408 Stephen,Hawking,55455 Anton,Van-Leeuwenhoek,60629 Max,Von-Laue,90029 Euclid,,55417 Melinda,Gates,55417 Gregor,Mendel,55414 Heike,Kamerlingh-Onnesek Max,Von,Laue,90029 Gustav,Kirchhoff Hans,Bethe,60617 Homas,Hunt,Morgan,55414 Hermann,Von-Helmholtz,60629 Paul,Ehrlich,55455 Ernst,Mayr,90029 Charles,Sherrington,55467 Heodosius,Dobzhansky,60629 Max,Delbruck,55455 Jean,Lamarck,60617 William,Bayliss,60622 Noam,Chomsky,55417 Frederick,Sanger,60622 Louis,Broglie,55414 Carl,Linnaeus,55467 Jean,Piaget,55417 George,Simpson,60622 Claude,Levi-Strauss,60629 Lynn,Margulis,55467 Karl,Landsteiner,60622 Konrad,Lorenz,60608 Edward,Wilson,60630 Gertrude,Elion,55467 Hans,Selye,55417 Robert,Oppenheimer,60630 Edward,Teller,60630 Willard,Libby,55414 Bill,Gates,55467 Jonas,Salk,55417 bill,gates,55417 Melinda,Gates,55417

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

Students also viewed these Databases questions

Question

I receive useful feedback about my performance.

Answered: 1 week ago

Question

I am encouraged to offer opinions/suggestions.

Answered: 1 week ago