Question: (Go Programming) The input data file will be named rainfall.txt and will consist of 12 lines, each containing a floating point number The function will

(Go Programming)

The input data file will be named rainfall.txt and will consist of 12 lines, each containing a floating point number

The function will have no parameters. It will return an array of 12 floats and an error.

The function should have 5 separate checks for errors: (1) opening the file, (2) parsing to a float, (3) wrong number of data items in file, (4) closing the file, and (5) scanner error

In all 5 error cases, the function should return a data array along with the error

If no errors occur, the function should return the array of 12 items read from the file along with nil

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!