PRG/421 Week 4 Java 4.6 LAB: Zip code and population (generic types)

$ 7

PRG/421 Week 4 Java 4.6 LAB: Zip code and population (generic types)

Define a class StatePair with two generic types (Type1 and type2), a constructor mutators, accessors, and a printinfo() method. Three ArrayLists have been pre-filled with StatePair data in main():
• ArrayList<StatePairInteger, String>> zipCodeState: Contains ZIP code/state abbreviation pairs
• ArrayList<StatePair<string, String>> abbrevstate: Contains state abbreviation/state name pairs
• ArrayList<StatePair<string. Integer>> state Population Contains state name/population 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 name/population pair from the ArrayList state Population and output the pair.

Ex If the input is:
21044

the output is:
Maryland: 6079602

992 in stock

SKU: PRG421WK4LAB4P6 Category:

Description

PRG/421 Week 4 Java 4.6 LAB: Zip code and population (generic types)

Define a class StatePair with two generic types (Type1 and type2), a constructor mutators, accessors, and a printinfo() method. Three ArrayLists have been pre-filled with StatePair data in main():
• ArrayList<StatePairInteger, String>> zipCodeState: Contains ZIP code/state abbreviation pairs
• ArrayList<StatePair<string, String>> abbrevstate: Contains state abbreviation/state name pairs
• ArrayList<StatePair> state Population Contains state name/population 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 name/population pair from the ArrayList state Population and output the pair.

Ex If the input is:
21044

the output is:
Maryland: 6079602

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.