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

Insert the missing code in the following code fragment. This fragment is intende

ID: 3830682 • Letter: I

Question

Insert the missing code in the following code fragment. This fragment is intended to read an input file named dataIn.txt and write to an output file named dataout.txt. Explain your answer. public static void main (String [] args) throws FileNotFoundException {String input FileName = "dataIn.txt"; String outputFileName = "dataout.txt"; File inputFile = _____; Scanner in = new Scanner (inputFile)} Assuming that inputFile is a scanner object used to read words from a text file fill in an expression to complete the following code segment, which counts the number of words in the file. Explain your answer. int count = 0; while (inputFile.hasNext ()) {String word = _____; count++;} System.out.println(count); Insert the missing code in the following code fragment. This fragment is intended to read all words from a text file. Explain your answer. File inputFile = new File ("dataIn.txt"); Scanner in = new Scanner (dataIn.txt) while (_____) {String input = in.next (); System.out.println (input);}

Explanation / Answer

Qustion 2

Answer: File inputFile = new File(inputFileName);

Qustion 3

Answer:String word = inputFile.next();

Qustion 4

Answer: while(in.hasNext())