size=2 width="100%" align=center>

Homework 8 - Perl


Given Wednesday, November 30, 2011

Due at 5pm on Saturday, December 10, 2011 via ANGEL

For this assignment, you will write a Perl script that parses the data in census2008.txt

 

The data is column delimited, with fields as follows:

 

SUMLEV,STNAME,CTYNAME,POPESTIMATE2008,BIRTHS2008,DEATHS2008

 

The data is from US Census Bureau estimates for 2008. The first column is a code for what “level” the data represents. It will be “040” for state data and “050” for county data. The next two columns are the state name and the county name (or state name repeated, if the date is for the whole state). Then we have the estimated population for that state or county in 2008, the number of  births for that state or county for 2008 and the number of deaths for that state or county for 2008.

 

Your script should report the state with the highest and the state with the lowest birth rates in 2008. Report the birth rate as births per 541 (a prime number) population.

Your script should also report the counties in Washington with the highest and lowest birth rates.

 

In all four cases, report the place name (the county or state) and the number of births per 541 population.

 

(Note that all counties in the US are included in the file, but your search of per-county birthrates should be limited only to the state of Washington.)

 

The scoring will be 20 points for a working Perl script that seems close, and 20 points each for correctly finding and reporting each of the 4 facts requested.

 

Example output:

Lowest birth rate in LOW-STATE: x.xxx per 541

Highest birth rate in HIGH-STATE: x.xxx per 541

In Washington:

   Lowest birth rate in LOW-COUNTY County, WA: x.xxx per 541

   Highest birth rate in HIGH-COUNTY County, WA: x.xxx per 541