Array implement

Hello,
i have to do that :
Write a program to read class grades from a file (A5Q3.dat - which is given to you) into an array grades and to then output to the screen the following information:
Class Average
Percentage of grades >= 90
Percentage of grades < 90 and >= 80
Percentage of grades < 80 and >= 65
Percentage of grades < 65 and >= 50
Percentage of grades < 50
Show average and percentages accurate to 2 places after the decimal (xx.xx and xx.xx%).
I need to put them into functions, but i will do that if i have the correct code, but can't seem to resolve it.
what i was able to do until now is: