Write a program that reads a file named input.txt and writes a file that contains the same contents, but is named output.txt. The input file will contain more than one line when I test this. Do not use a path name when opening these files. This means the files should be located in the top level folder of the project. Do not use a copy method that is supplied by Java. Your program must read the file line by line and write the file itself.
DO NOT WRITE TO input.txt! Double check this and class name should be FileCopy. The program must work in Eclipse, even if you use a different IDE to develop it. It is best to use Eclipse.
Code
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class FileCopy
{
public static void main(String[] args)
{
BufferedReader reader;
try
{
reader = new BufferedReader(new FileReader("input.txt"));
String line = reader.readLine();
FileWriter fw=new FileWriter("output.txt");
while (line != null)
{
fw.write(line+"\r\n");
line = reader.readLine();
}
reader.close();
fw.close();
System.out.println("File Copied!!!");
} catch (IOException e)
{
e.printStackTrace();
}
}
}
input.txt

output

output.txt file
If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.
Write a program that reads a file named input.txt and writes a file that contains the...
How to write a Java program that reads the file "input.txt" and writes all even values from this file into a new file called "output.txt." Sample input 10 12 1 3 5 34 2 5 7 9 44
C++ Write a program that reads from the external file input.txt, counts the letters in every word, replaces the word by that number, and then writes the numbers to an external file output.txt (Note: Do not forget to copy the blanks. You may wish to use infile.get and outfile.put in your program.) Also you may wish to use the strlen( ) function. Output: After the program generates output.txt, the code should display the contents of the file on the screen...
1. use c++ write a c++ program that reads 10 integers from a file named input.txt in this file the 10 integers wil be on a single line with space between the. calculate the average of these numbers and then write his number to a file named output.txt. if the program is unable to successfully complete the file operations then display eero message to the console.
Write a C program that reads a list of positive integers from a file named "input.txt." and count number of odd integers and even integers and prints the results to another file called "results.txt". Please submit both the input and results files along with the c program.
python
Create a program to open a text file for reading, find the maximum number in the file, determine if that maximum number is even, and write to an output text file. You should either write Yes if the number is even, otherwise write the maximum number. You should note the following: • Your input file must be named input.txt • The input file has one integer number per line • Your output file must be named output.txt • Your...
Java console-based question. Do not use BufferedReader please. A file named customers.txt contains the names of customers for a local hairdressing salon. Unfortunately, the data in the file is in no particular order yet the owner of the salon would like the data in alphabetical order. Write a Java program that reads the contents of the file into an array of Strings, sorts the array of Strings into alphabetical order, and then writes the content of the array to a...
( IN JAVA): Write a program that reads each line in a file, and writes them out in reverse order into another file. This program should ask the user for the name of an input file, and the name of the output file. If the input file contains: Mary had a little lamb Its fleece was white as snow And everywhere that Mary went The lamb was sure to go Then the output file should end up containing: The lamb...
write a program in c ++ that reads the length and width of a rectangle from a file named input.txt and write the area and perimeter of the rectactangle to file named output.txt
C++
Write a program based on 8_lb that reads in the integer data from "input.txt" into a vector. Please prompt for the file name and append the "txt". Then create another vector where each element is the original vector times 10. Create a variable total and sum up the numbers from the second vector. The total should be 17510. Then write the data from the original vector and the 10 times vector to a file. See output.txt for the format....
java question: Write a program that reads in data from a text file named in.txt. Compute the sum of all the valid integers in the input file. Likewise, compute the sum of all the valid doubles in the input file. Write the former to an output file called int_total.txt, and write the latter to an output file called double_total.txt. B) Write a program that converts the Java source code from the next-line brace style to the end-of-line brace style. For...