a. Create a Score Exception class that extends Exception and whose constructor accepts a String parameter and

Question:

a. Create a Score Exception class that extends Exception and whose constructor accepts a String parameter and passes it to the Exception class constructor. Save the file as ScoreException.java.

b. Write an application in which you store at least five student ID numbers in an array. One at a time, display the ID number and prompt the user to enter a test score for the student. Catch any Exception thrown if the user does not enter an integer for the score, display an error message, and set the score to 0. Throw a Score Exception if the user enters a score greater than 100. Catch the Score Exception, display an appropriate message, and then store a 0 for the student’s score. At the end of the application, display all the student IDs and scores. Save the file as TestScore.java.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question

Java Programming

ISBN: 9780357673423

10th Edition

Authors: Joyce Farrell

Question Posted: