Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Ministry of Education invites you to develop a system to verify the exam marks entered by the users to system for further processing. The
Ministry of Education invites you to develop a system to verify the exam marks entered by the users to system for further processing. The information of students is stored in a text file called "exam.txt". The following shows the file format:(you can copy and paste them in a text file) 111111 222222 90 abc 333333 108 444444 78 555555 -90 666666 9X 777777 88 888888 888 999999 GoodLuck You propose the following classes in design: Student MarkException -int id -String mark 1..1 Exam_4 static Scanner input -static void processMark(String mark) -static boolean invalidMark(String mark) -static void displayList(ArrayList alist) +static void main(String)] args) (a) A user defined exception class called MarkException, a subclass of Exception class, that you can retrieve the exception message during processing. (b) A Student class has student id (int type, and final) and mark (String type). You prefer to choose String type as user may not enter an integer for exam mark. This is a very simple class consists of instance variables, accessor methods, mutator method, toString method (you can see the format of the string in the following display). (c) A main class that drives the application. Main method reads all info stored in the input file (i.e., exam.txt) and process them. For each line of input, you create a Student object (valid or invalid; invalid means exception occurs); if invalid, you attach some relevant exception message next to the mark. Add all objects to a list. Note that all exceptions should be handled in main. Other useful methods in this class: -The invalidMark method is make sure that all characters in the mark are digits - The processMark method checks the marks and throws three different exception messages, i.e. mark is negative, invalid characters in mark and mark is greater than 100. -The displayList method uses a Lambda expression to display the list's content: 123 123 123 Summary report Student id: 111 Student id: 2222 Student id: 333 Student id: 4444 Student id: 555555 Student id: 666666 Student id: 777777 Student id: 888888 Student id: 999999 Mark: 90 Mark: abc Mark: 108 Mark: 78 Mark: -90 Mark: 9x Mark: 88 Mark: 888 MarkException: Mark has invalid character(s) MarkException: Mark greater than 100 MarkException: Negative mark MarkException: Mark has invalid character(s) MarkException: Mark greater than 100 Mark: Goodluck MarkException: Mark has invalid character(s)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started