Programming Assignment 2 TCSS 142 

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

Even though the prediction of earthquakes remains an open problem, statistical analysis is
one of the methods currently used to find recurrent patterns. You need to write a
program that will read in the earthquake data, classify it according to its magnitude, and
print a report to another file.
Input
All earthquake data is located in a file earthquakes.txt. we discussed during lectures.
Processing
Earthquakes are classified into categories, depending on their magnitude. Your program is
to handle the following categories:
Class Magnitude
Great 8 or more
Major 7 – 7.9
Strong 6 – 6.9
Moderate 5 – 5.9
Lists are to be used as parallel data structures containing the data:
 A list of region names, where none of the names is repeated
 A list for each earthquake category, where the data in these lists is to be parallel
to the names list, namely, if name[0] contains Gulf of California, then great[0] is
the number of “great” earthquakes that occurred in that region, major[0] is the
number of “major” earthquakes that occurred in that region, etc.
Output
You are to write the following statistics to a csv file (a name of which will be entered at
run time). Your statistics for this file and formatting should look as follows:
REGION MODERATE STRONG MAJOR GREAT OVERALL
OFF THE EAST COAST OF HONSHU JAPAN 79 7 1 0 87
NEAR THE EAST COAST OF HONSHU JAPAN 91 19 1 1 112
BOUGAINVILLE REGION PAPUA NEW GUINEA 1 0 0 0 1
SOUTH SANDWICH ISLANDS REGION 2 1 0 0 3
GULF OF CALIFORNIA 2 0 0 0 2
NEW IRELAND REGION PAPUA NEW GUINEA 1 0 0 0 1
Once you write these statistics, you need to append additional information to a file
summary.txt. This information is to contain the total number of earthquakes of magnitude
>= 5 processed and the region/s with the highest number of earthquakes (there may be
more than one region matching this max). For example:
TOTAL NUMBER OF EARTHQUAKES DURING THE PERIOD 2014/10/11-2014/10/18: 21
REGIONS WITH THE HIGHEST NUMBER OF EARTHQUAKES:
NEAR THE EAST COAST OF HONSHU JAPAN 112
Note: If you want to append to a file, use “a” instead of “w” when opening it.
Finally, when you are done writing to the second file, print a message to the screen:
“Processing Complete”
Program Submission
If you want your assignment to be graded, it has to be compatible with our platform,
namely Python 3.4.1 The source code is to be called yourNetid_project2.py
On or before the due date, use the link posted in Canvas next to Programming
Assignment 2 to submit your code