Part A
view original csv file
$filename = "contacts.csv";
$infile = fopen($filename, "r") or exit("Unable to open data file.");
echo "Contents of CSV:
";
$my_data = array();
$count = 0;
while ( ( $record = fgetcsv($infile) ) !== FALSE) {
$my_data[$count] = array();
$my_data[$count] = $record;
$count++;
}
fclose ($infile);
echo "*Filtered for Zip:60267 OR Sate:CA
";
foreach ( $my_data as $record )
{
if ( $record[4] == 'CA' || $record[5] == 60267 ) {
echo "";
print_r ( $record );
echo "";
}
}
?>
view original txt file
Contents of Array:
Array
(
[0] => 36
[1] => 76
[2] => 23
[3] => 34.4
[4] => 87
[5] => 98.6
[6] => 12
[7] => 100.5
[8] => 34
[9] => 87
[10] => 123
[11] => 9.7
)
data.txt statistics:
min = 9.7
max = 123
avg = 60.1
Part B
Original Poem:
door chamber my at rapping rapping gently one some of
As tapping a came there suddenly napping nearly nodded I
While lore forgotten of volume curious and quaint a many
Over weary and weak pondered I while dreary midnight a upon
Once Corrected Poem:
Once upon a midnight dreary while I pondered weak and weary
Over many a quaint and curious volume of forgotten lore
While I nodded nearly napping suddenly there came a tapping
As of some one gently rapping rapping at my chamber door