Answer to Question #8971 in Java | JSP | JSF for java exercise

Question #8971
·It captures the “NumberFormatException” that is thrown if a string cannot be converted to a number. When the exception is captured, the user must be informed that he is an idiot. ·Define a new exception called “NotMemberException”. The exception must be thrown if the registration number entered by the user does not exist in the list of StudInfo. Your program should catch the exception as follows. It should first try to see if the number before and after the one entered exists. If so, it informs the user that they probably made a typo and provides them the name of the found student. If neither is found it must simply inform the user that such registration number does not exist. /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package exhandassgn; import; import; import; import java.util.ArrayList; /** * * @author christoforos */ public class Main { /** * @param args the command line arguments */ static ArrayList<StudInfo> ls; public static void main(String[] args) { populate(); System.out.println("Enter a registration number:"); BufferedReader in = new BufferedReader(new InputStreamReader(; try { String inp = in.readLine(); int rVal = Integer.parseInt(inp); StudInfo foundStudent = getStudent(rVal); System.out.println(foundStudent.getName()); } catch(IOException ioe) {System.out.println(ioe.getMessage());} } static void pop
Expert's answer
Unfortunately, your question requires a lot of work and cannot be done for free.
Submit it with all requirements as an assignment to our control panel and we'll assist you.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog