Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is your starter file: Potus.java DO NOT USE COMMAND LINE ARGS. I HAVE HARDCODED THE INPUT FILE NAMES INSIDE THE STARTER FILE EXECUTE LINE

Here is your starter file: Potus.java

DO NOT USE COMMAND LINE ARGS. I HAVE HARDCODED THE INPUT FILE NAMES INSIDE THE STARTER FILE

EXECUTE LINE THIS: c:> java Potus (no command line arg filenames!)

STEP #1 worth 70% SAMPLE CODE TO DO => STEP#1

Read the state2Presidents.txt file into a map such that when you print the map out the rows are sorted vertically by state and each row's set of presidents on that row are sorted alphabetically

STEP #1 output is worth 70%

Arkansas Clinton California Nixon Connecticut Bush_GW Georgia Carter Hawaii Obama Illinois Reagan Iowa Hoover Kentucky Lincoln Massachusetts Bush_GHW Kennedy Missouri Truman Nebraska Ford New_Hampshire Pierce New_Jersey Cleveland New_York Fillmore Roosevelt_F Roosevelt_T VanBuren North_Carolina Johnson_A Polk Ohio Garfield Grant Harding Harrison_B Hayes McKinley Taft Pennsylvania Buchanan Texas Eisenhower Johnson_L Vermont Arthur Coolidge Virginia Taylor Tyler Wilson

STEP #2 OUTPUT worth 15%.

Print the inverse of the state2presidents map. List each president on his own line with the state where he was born. You do not have to explicitly store this inversion into a map but you must generate the following output exactly. The lines are sorted by president alphabetically. You may Use the allPresidents.txt file in any way needed for this step but be aware the allPresidents.txt file contains all the presidents of the US - and some of them do not have a birth state associated with them since they were not born before the states were formed. You are only to list those presidents who have a birth state.

Arthur Vermont Buchanan Pennsylvania Bush_GHW Massachusetts Bush_GW Connecticut Carter Georgia Cleveland New_Jersey Clinton Arkansas Coolidge Vermont Eisenhower Texas Fillmore New_York Ford Nebraska Garfield Ohio Grant Ohio Harding Ohio Harrison_B Ohio Hayes Ohio Hoover Iowa Johnson_A North_Carolina Johnson_L Texas Kennedy Massachusetts Lincoln Kentucky McKinley Ohio Nixon California Obama Hawaii Pierce New_Hampshire Polk North_Carolina Reagan Illinois Roosevelt_F New_York Roosevelt_T New_York Taft Ohio Taylor Virginia Truman Missouri Tyler Virginia VanBuren New_York Wilson Virginia

STEP #3 OUTPUT worth 10%

Print a sorted list of presidents who have no birth state associated with them. These presidents were actually born on this continent but were born before the states were created.

Adams_J Adams_JQ Harrison_W Jackson Jefferson Madison Monroe Washington

STEP #4 worth 5%

Print a sorted list of states that have no president born in them. You may use the allStates.txt file for this.

Alabama Alaska Arizona Colorado Delaware Florida Idaho Indiana Kansas Louisiana Maine Maryland Michigan Minnesota Mississippi Montana Nevada New_Mexico North_Dakota Oklahoma Oregon Rhode_Island South_Carolina South_Dakota Tennessee Utah Washington West_Virginia Wisconsin Wyoming

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_2

Step: 3

blur-text-image_3

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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

Students also viewed these Databases questions

Question

42 Pay programs (for example, incentive, variable, merit).

Answered: 1 week ago