answer in java.
Write a class named TestScores. The class constructor should accept an array of test scores as its
argument. You will need to do a deep copy of the array, don’t just copy the address of the array. The
class should have a method that returns the average of the test scores. If any test score in the array is
negative or greater than 100, the class should throw an IllegalArgumentException.
Write an exception class named InvalidTestScore. Create a setScores() method in TestScores which
accepts an array of test scores. Validate each item in the array and if any test score in the array is
negative or greater than 100, the class should throw an InvalidTestScore Exception.
Next create another method in TestScore called getScoresFromFile(). This method should open a file
that you created in Notepad and it should contain a list of test scores, some valid and others not. Read
in each of these test scores and store into an array. The first entry in the file should be the number of
scores that should be read. This number should be used to properly create the test score array. The
method should properly handle the potential FileNotFoundException. If file does not exist the program
should stop and exit with your own error message. As each score is read from the file (use nextInt())
throw either an IllegalArgumentException or an InvalidTestScore if the number read is not between 1
and 100 inclusive. You also need to handle an InputMismatchException. This means that either a
string was encountered or a floating-point number was encountered while reading the file. When this
happens issue an error message, but continue processing the file until you reach end of file. Note:
When this happens the entry you will add to the test score array will contain 0. How you accomplish
this is up to you. Feel free to discuss with your instructor.
Demonstrate all this functionality in a main() program