Write a program which reads a list of grade point averages into an array of type double (and size 10). After the program has completed reading, the contents of the array are printed out. Define and use a function which prompts the user for a grade point average (or negative value to end) and reads the value. The function, in a loop: 1. checks that a valid number has been entered (see scan_fraction logic from lab05) 2. if the value is negative (input end signal), return -1 3. check that the number entered is in the range 0 to 4.0. If either check fails, write an error message “invalid gpa, entry ignored?? and repeat the loop. The function has one output argument (gpa) and returns 0 (if a valid gpa has been entered) or ??"1 to signal that reading terminates. Your program (main) will, in a loop, repeatedly call this function for gpa values and, as long as the function returns 0, insert them into the array. The loop terminates: 1. when the function returns ??"1 OR 2. when the array is full The program then prints out the list of gpa values. Test with a list of gpa values less than, equal to, and greater than the capacity of the array. Test the function by supplying a bad gpa (type some letters instead of numbers) and some gpa values outside 0.0 to 4.0. Document this program according to the guidelines. Poorly or non-documented programs will be downgraded.
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request. 3) Complete ownership and distribution copyrights to all work purchased. Sample Tests Script started on Fri Mar 28 13:55:55 2003 % gpa_array supply gpa between 0.0 and 4.0 (-1 to exit): -1 Grade Point Averages Array pos gpa % gpa_array supply gpa between 0.0 and 4.0 (-1 to exit): aaa invalid gpa - reenter supply gpa between 0.0 and 4.0 (-1 to exit): 5.2 gpa out of range -reenter supply gpa between 0.0 and 4.0 (-1 to exit): 3.2 supply gpa between 0.0 and 4.0 (-1 to exit): 2.1 supply gpa between 0.0 and 4.0 (-1 to exit): -1 Grade Point Averages Array pos gpa 0 3.20 1 2.10 % gpa_array supply gpa between 0.0 and 4.0 (-1 to exit): 0.1 supply gpa between 0.0 and 4.0 (-1 to exit): 1.2 supply gpa between 0.0 and 4.0 (-1 to exit): 2.3 supply gpa between 0.0 and 4.0 (-1 to exit): 3.4 supply gpa between 0.0 and 4.0 (-1 to exit): 4.1 gpa out of range -reenter supply gpa between 0.0 and 4.0 (-1 to exit): 1.2 supply gpa between 0.0 and 4.0 (-1 to exit): 2.4 supply gpa between 0.0 and 4.0 (-1 to exit): 0.1 supply gpa between 0.0 and 4.0 (-1 to exit): 0.0 supply gpa between 0.0 and 4.0 (-1 to exit): 4.0 supply gpa between 0.0 and 4.0 (-1 to exit): 3.9 Array full -data entry terminated Grade Point Averages Array pos gpa 0 0.10 1 1.20 2 2.30 3 3.40 4 1.20 5 2.40 6 0.10 7 0.00 8 4.00 9 3.90 % exit
## Platform
Linux or Unix