Question: The next one is the weather station program as specified Now that we have the data in an array, we can calculate the statistics. Add
Now that we have the data in an array, we can calculate the statistics. Add the possibility of an optional fourth token on a line, found only in readings with precipitation, containing the duration of precipitation, This will be given in the format 1:43 where 1 is the number of hours and 43 is the number of minutes (may be one or two digits). The : may be omitted, meaning the value is just the number of hours (zero minutes), or the number of hours may be omitted. For example 10,3Nw, 15cm,4:38 5,15Sw, 8mm, 2:8 8, 8ENE, 2mm,:25 -5,0,7,1 -3,0, 3m Download the complete Weather Station program and add the following features to it 1. Add hours and minutes instance variables to the Reading class. Zero values for both indicate no data (or no precipitation) 2 Add the code to the main program to parse the extra data on the line. Hint once you have split the CSV line into tokens, you may want to take the fourth token (if it exists) and split it according to the position of the : 3. Make sure you deal with the same situations as the original program. neither duration values can be negative, and use trimO to remove excess whitespace Submit your complete modified program by the due date specified in the course schedule. Add a comment to the top of the program indicating whether you think it works in all cases described above, or if there are some it has trouble processing (and why)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
