Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python2.7 1. (20 points) Write a function processTropicalStorms() that takes the name of a file as a parameter. Each line of the file corresponds to
python2.7
1. (20 points) Write a function processTropicalStorms() that takes the name of a file as a parameter. Each line of the file corresponds to information about a tropical storm. In particular a line contains a name, wind speed, rain fall amount and year. The function will process the file, creating a TropicalStorm object for each line in the file. The function will print information about each line as it processes it, as well as appending the new TropicalStorm object into a list. Make sure to use TropicalStorm methods to display information rather than recreating the work you did for the first problem. Once the entire file has been processed, the function returns the list of TropicalStorm objects created from the file. If the file is empty, the function should return an empty list. If the input file cannot be opened, the function should print a message to that effect and then return an empty list. The following shows what would be displayed for two example files which have been provided in the homework zip file posted to D2L. The file none.txt does not exist. Please note that your function must work on an arbitrary file that consists of valid lines. You cannot assume anything about the file except that it contains lines that have the format described above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started