Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java provides a package of collection classes that include a list named ArrayList. Develop a client program Prog1.java that maintains a list of states with

Java provides a package of collection classes that include a list named ArrayList. Develop a client program Prog1.java that maintains a list of states with their abbreviation and population. The program should begin by reading the states.txt file, creating State object, and storing the State objects in an ArrayList data structure.

states.txt file: CSV (comma separated value) text file in which each line in the file contains information about a state. The comma delimited fields are:

Fields

Description

Abbreviation

2 characters

Name

Name of the state (may contain blanks)

Population

Integer, population of the state

After the ArrayList is filled, print the states in an easy to read tabular format with commas in the population counts. Then, ask the user for a state abbreviation and display the name and population for that state.

Requirements

  • Your source code should abide by the Java programming standards for the course.
  • Your source code should be documented using Javadoc style according to the course standards.
  • Use the default package in your project; do not specify a package in your code.
  • Use any file and class names specified in the assignment.
  • Your test program must be named Prog1.

csv file

AL, Alabama, 4858979 AK, Alaska, 738432 AZ, Arizona, 6828065 AR, Arkansas, 2978204 CA, California, 39144818 CO, Colorado, 5456574 CT, Connecticut, 3590886 DE, Delaware, 945934 FL, Florida, 20271272 GA, Georgia, 10214860 HI, Hawaii, 1431603 ID, Idaho, 1654930 IL, Illinois, 12859995 IN, Indiana, 6619680 IA, Iowa, 3123899 KS, Kansas, 2911641 KY, Kentucky, 4425092 LA, Louisiana, 4670724 ME, Maine, 1329328 MD, Maryland, 6006401 MA, Massachusetts, 6794422 MI, Michigan, 9922576 MN, Minnesota, 5489594 MS, Mississippi, 2992333 MO, Missouri, 6083672 MT, Montana, 1032949 NE, Nebraska, 1896190 NV, Nevada, 2890845 NH, New Hampshire, 1330608 NJ, New Jersey, 8958013 NM, New Mexico, 2085109 NY, New York, 19795791 NC, North Carolina, 10042802 ND, North Dakota, 756927 OH, Ohio, 11613423 OK, Oklahoma, 3911338 OR, Oregon, 4028977 PA, Pennsylvania, 12802503 RI, Rhode Island, 1056298 SC, South Carolina, 4896146 SD, South Dakota, 858469 TN, Tennessee, 6600299 TX, Texas, 27469114 UT, Utah, 2995919 VT, Vermont, 626042 VA, Virginia, 8382993 WA, Washington, 7170351 WV, West Virginia, 1844128 WI, Wisconsin, 5771337 WY, Wyoming, 586107

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

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions