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
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