Question: code should be written in java The purpose of this problem is to practice writing a program in Java, that woks with files and exception
The purpose of this problem is to practice writing a program in Java, that woks with files and exception handling. .part a- a method to input data from a user and store in a 2d array part b-amethod to output data stored in the 2d array to a text file part d-the NumberException class .part c-the main method a. The first method will read data from the user (console), including a student number followed by a mark i. The method will detect these 2 types of input errors: the student number is invalid (not between 1000 and 99999), and the grade is not between 0 and 100 If the method detects either of these errors it will generate an exception: NumberException or GradeException ii. ii. If an exception is raised the method does not handle it. It is returned to the main to be iv. handled (by printing an error message and terminating the program) The input data will be stored in a 2d array of integers Keep reading from the user until 10 entries have been added to the 2d array v. b. Write an output method that will write, to a text file, the contents of the 2d array (containing the student numbers and grades read in by the input method). the output method will create, open, and close the output text file the output method should not handle input/output exceptions; these are returned to the main to be handled (by printing an error message and terminating the program) c. Write a main to call the input and output methods from parts a and b above. Include the appropriate exception handling mechanism in main. d. Write the code for the exception class NumberException and the GradeException class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
