Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

private void readTransaction(String filename) try //Scanner scanner new Scanner

ID: 3719842 • Letter: P

Question

private void readTransaction(String filename) try //Scanner scanner new Scanner (new FileReader(filename)); /*int i 0; while (scanner.hasNext( String line -scanner.nextLine() processLoan (line); BufferedReader reader = new BufferedReader(new FileReader(filename)); int i-0; String line; line reader. readLine(); while (linenull&&line.equals;(")) processLoan (line); line - reader.readLine); System.out.println("" + 1 + " loan transactions read include the unsuccessful transaction!"); ) catch (Exception e) { System.err.println(e.getMessage)); e.printStackTrace();

Explanation / Answer

As you are getting output in the console.There is no exception generated by your code.So,your code is working fine.Your code for reading from a file is also error-free.

You may consider using

SimpleDateFormat sdf=new SimpleDateFormat(pat);Re-check your Borrow class also once .Try printing the values in the constructor of Borrow class as to make sure values of transactionId,borrowDate,memberId,bookID,dueDate are recieved correctly .