Project2 CECS277 solution

$25.00

Category:

Description

5/5 - (3 votes)

Student average score
Professor Navarro is trying to find the average score for 5 exams. She wants to drop the lowest
and highest scores from the list before finding the average.
Below is a sample input list of students with 5 scores for 5 exams:
studentName ex1 ex2 ex3 ex4 ex5
===================================
Jones Tom 94 99 96 74 56
Thompson Frank 67 58 86 95 47
Jackson Tom 95 97 94 87 67
Jackie Michael 43 23 34 77 64
Johnson Sara 84 93 64 57 89
Colt McCoy 84 93 64 57 70
Freeman Tina 67 58 86 95 47
• First, we will ask the user to enter the number of students in her class. Then, we will ask
student name and scores for 5 exams. Store this information into a two-dimensional array.
Your program should include the following methods:
• getStudentInfo() should ask the user for student info including student name and 5 scores,
before storing each of these scores into the array, make sure to validate it by calling another
method ValidateUserInput(score). The method getStudentInfo() should be called from the
main method.
• findLowest(scores) should find and return the lowest of the 5 scores passed to it.
• findHighest(scores) should find and return the highest of the 5 scores passed to it.
• calcScore(scores) should calculate and return the average of the 3 scores that
remain after dropping the highest and lowest scores the student received. This
method should be called just once by main and should be passed the scores.
findHighest() and findLowest(), should be called by calcScore, which uses the returned
information to determine which of the scores to drop.
• print() method will display the table in the following format.
Sample output:
student Name ex1| ex2| ex3| ex4| ex5|Average
==========================================
Jones Tom 94 99 96 74 56 88
Thompson Frank 67 58 86 95 47 70.33
Jackson Tom 95 97 94 87 67 ..
Jackie Michael 43 23 34 77 64 ..
Johnson Sara 84 95 64 57 89 ..
Colt McCoy 84 93 86 67 70 80
Freeman Tina 67 58 86 95 47