Building on Lab Assignment 9 (TestScores Class Custom Exception), modify your code as follows: Read in an array of test scores from a file. If any of the test scores are invalid (via InvaidTestScore exception), then skip the invalid test score and continue to process your input file until an EOF (end-of-file); write out to a new (valid) data file. You may choose your input data file regarding values. For the File I/O, you should use: InputStream and OutputStream Classes. Only the Java code is needed for this assignment. Basic Example: File inputFile = new File("readTestScores.txt"); File outputFile = new File("writeTestScores.txt"); FilelnputStream fis = new FilelnputStream(inputFile); FileOutputStream fos = new FileOutputStream(outputFile); For Reference (Lab 9 Assignment) 1. TestScores Class Write a class named Testscores. The class constructor should accept an array of test scores as its argument. 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. Demonstrate the class in a program. 2. TestScores Class Custom Exception Write an exception class named InvalidTestScore. Modify the Testscores class you wrote in Programming Challenge 1 so that it throws an InvalidTestscore exception if any of the test scores in the array are invalid.
Building on Lab Assignment 9 (TestScores Class Custom Exception), modify your code as follows: Read in an array of test scores from a file. If any of the test scores are invalid (via InvaidTestScore exception), then skip the invalid test score and continue to process your input file until an EOF (end-of-file); write out to a new (valid) data file. You may choose your input data file regarding values. For the File I/O, you should use: InputStream and OutputStream Classes. Only the Java code is needed for this assignment. Basic Example: File inputFile = new File("readTestScores.txt"); File outputFile = new File("writeTestScores.txt"); FilelnputStream fis = new FilelnputStream(inputFile); FileOutputStream fos = new FileOutputStream(outputFile); For Reference (Lab 9 Assignment) 1. TestScores Class Write a class named Testscores. The class constructor should accept an array of test scores as its argument. 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. Demonstrate the class in a program. 2. TestScores Class Custom Exception Write an exception class named InvalidTestScore. Modify the Testscores class you wrote in Programming Challenge 1 so that it throws an InvalidTestscore exception if any of the test scores in the array are invalid.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education