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

Can anyone debug this for me please? Java code to copy package debugmeone; impor

ID: 3853269 • Letter: C

Question

Can anyone debug this for me please? Java

code to copy

package debugmeone;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class ReadTextFile {

private Scanner input; // Ignore the hint given by NetBeans

public void openFile() {
try
{
input = new Scanner( new File("accountrecords.txt"));
}
catch(Exception e)
{
System.out.println("Something bad just happened here.");
System.exit(707);
}
catch( FileNotFoundException fnfe)
{
System.out.println("Error - File Not Found: accountrecords.txt");
System.exit(100);
}
}
}

ITCS-2590 Debugging Execse Chapter 11 - NetBeans IDE 8.2 File Edit View Navigate Source Refactor Run Debug Profile Teem Tools Window Help Search (Ct1+) ReadTextFile.java x Source History Projects X 1013 93b 98 23 public cla" ReadTextPile { 24 25 26 27 28 29 30 31 TCS-2990 Debugging Exercise Source Packages private Scanner input: Ignore the hint given by NetBeans ReadTextile.java public void openFilc) ..iReadTextFileTest.java trY Test Packeges Lbrarnes Test Libraries input = new scanner ( new File ("account records. txt")) ; catch (Exception e) ITCS-2590 Debugging Exercse 34 35 36 Syetem.out.println( Something bad Just happened here-") Syatem.exit(707) catch FileNotFoundExc ion fnfe 38 39 40 41 42 43 Syatem.out.println ( Error-File Not Found: accountrecords.txt") System.exit (100) Test Results X OutputX 23:28 INS Type here to search @ ^ dq) 4:43 PM 6/30/20172

Explanation / Answer

package debugmeone;

import java.io.File;

import java.io.FileNotFoundException;

import java.util.Scanner;

public class ReadTextFile {

private Scanner input; // Ignore the hint given by NetBeans

public void openFile() {

try

{

input = new Scanner( new File("accountrecords.txt"));

}

catch( FileNotFoundException fnfe)

{

System.out.println("Error - File Not Found: accountrecords.txt");

System.exit(100);

}

catch(Exception e)

{

System.out.println("Something bad just happened here.");

System.exit(707);

}

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote