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

oo AT&T; LTE 1:24 PM wildcat.cookman.edu V. File 1/O: text file: Example LAB 18

ID: 3599085 • Letter: O

Question

oo AT&T; LTE 1:24 PM wildcat.cookman.edu V. File 1/O: text file: Example LAB 18 import8-0- publie elass CopyFsle publie statie void main (Sering args(1) throws IOExceptson FileReader in-nall in-new 711eReader ("input.xt" out- ew FileWester("output.EE" int e while ((e-in.adO) out.vrite (c) Lab 18 Create a file copier utility program given in the previous slide. -Do not use import iava.ioas in the example. Specify each class you need to import. Test your program and capture the output. ue 10/20/2017 Byh el., CS231, assignments, HW18: attach the following: 1) A pdf file showing compilation and execution results. File name: CS231 lastname-firstname Lab 18.pdf 1) A zipped file of all the java source files. File name: CS231 lastname-firstname Lab-18.zip

Explanation / Answer

input.txt

12
23
34
45
56
67
78

CopyFile.java

import java.io.FileReader;

import java.io.FileWriter;

import java.io.IOException;

public class CopyFile {

public static void main(String[] args) throws IOException {

FileReader in=null;

FileWriter out=null;

in=new FileReader("input.txt");

out=new FileWriter("output.txt");

int c;

while((c=in.read())!=-1)

{

out.write(c);

}

in.close();

out.close();

}

}

______________

output.txt

12
23
34
45
56
67
78

_______________Thank YOu