Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Define a class StatePair with two generic types ( Type 1 and Type 2 ) , a constructor, mutators, accessors, and a printInfo ( )
Define a class StatePair with two generic types Type and Type a constructor, mutators, accessors, and a printInfo method. Three ArrayLists have been prefilled with StatePair data in main:
ArrayList zipCodeState: Contains ZIP codestate abbreviation pairs
ArrayList abbrevState: Contains state abbreviationstate name pairs
ArrayList statePopulation: Contains state namepopulation pairs
Complete main to use an input ZIP code to retrieve the correct state abbreviation from the ArrayList zipCodeState. Then use the state abbreviation to retrieve the state name from the ArrayList abbrevState. Lastly, use the state name to retrieve the correct state namepopulation pair from the ArrayList statePopulation and output the pair.
Ex: If the input is:
the output is:
Maryland:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started