I am in a Java class and I have an assignment that I am really stuck on.
Here is the assignment:
Write a program that reads a student's name together with his or her test scores. The program should then compute the average test score for each student and assign the appropriate grade. The grade scale is as follows: 90-100,A ; 80-89,B ; 70-79,C ; 60-69,D ; 0-59,F.
Your program must use the following methods;
a. A void method, calculateAverage, to determine the average of the five test scores for each student. Use a loop to read and sum the five test scores. (This method does not output the average test score. That task must be done in the method main.)
b. A value-returning method, calculateGrade, to determine and return each student's grade. (This method does not output the grade. That task must be done in the method main.)
Test your program on the following data. Read the data from a file and send the output to a file. Use the appropriate parameters to pass the values in and out of the methods.
Johnson 85 83 77 91 76
Aniston 80 90 95 93 48
Cooper 78 81 11 90 73
Gupta 92 83 30 69 87
Blair 23 45 96 38 59
Clark 60 85 45 39 67
Kennedy 77 31 52 74 83
Bronson 93 94 89 77 97
Sunny 79 85 28 93 82
Smith 85 72 49 75 63
I have been staring at this problem for hours trying to figure out just how to execute it but I am having a lot of trouble. I am trying to figure out just how to get the average grade for each student. Now I know how to add the five together and divide by 5 (the number of test scores). I understand the math I am having a hard time figuring out how to code it the way the book wants me to.
Any suggestions, tips, examples, help, ect. will be greatly appreciated! Thanks a ton!