1. Engineering
  2. Computer Science
  3. 3 20 points write a function process tropicalstorms0 that takes...

Question: 3 20 points write a function process tropicalstorms0 that takes...

Question details

3. (20 points) Write a function process TropicalStorms0 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.
media%2Fcb4%2Fcb44f65f-cdde-4d22-b245-a2
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution