Arrays Assignment

See this link for AssignmentPolicies, Submission Instructions, and Grading Guidelines.

Instructions

1.      Write a Java application that doesthe following.

2.      Instantiate an array of 10 integers.

3.      Ask the user to enter up to 10 exam scores (whole numbers).

4.      Loop up to 10 times.

5.      If the user enters a -1, then quit looping.

6.      Or if 10 grades are entered, then also quit looping.

7.      Within the loop, store each integer in an array.

8.      If the user enters an integer below -1 or above 100, then useif statements to display an error message & keep looping.

9.      If the user enters a non-integer, then use try/catch blocks todisplay an error message & keep looping.

10.  To avoid getting an infinite loop, use Scanner methodnextLine() inside your catch block.

11.  After the loop, display all the exam scores in your array.

12.  Also display the average of the exam scores.

13.  See example I/O below.

 

Enter up to 10 examscores.

Enter -1 to quit.

 

Enter exam score:100

Enter exam score: 91

Enter exam score:-5000

ERROR: That is not avalid exam score.

Enter exam score: 55

Enter exam score:101

ERROR: That is not avalid exam score.

Enter exam score: 30

Enter exam score: 58

Enter exam score:seventy seven

ERROR: That is notan integer.

Enter exam score: 77

Enter exam score:99.99

ERROR: That is notan integer.

Enter exam score: 89

Enter exam score: -1

 

Your exam scoresare: 100, 91, 55, 30, 58, 77, 89,

Average of examscores: 71.42857142857143

 

 

 

© 2007 William Albritton