Question: Uppercase File Converter Write a program that asks the user for the names of two files. The first file should be opened for reading and
Uppercase File Converter
Write a program that asks the user for the names of two files. The first file should be opened for reading and the second file should be opened for writing. The program should read the contents of the first file, change all characters to uppercase, and store the results in the second file. The second file will be a copy of the first file, except that all the characters will be uppercase.
I have the following:
import java.io.*; import java.util.Scanner;
public class low_To_UP { public static void main(String[] args) throws IOException { Scanner keyboard = new Scanner(System.in); String inputFile; String outputFile; String writeToFile; System.out.print("Enter the input file name: "); inputFile = keyboard.nextLine(); System.out.print("Enter the output file name: "); outputFile = keyboard.nextLine(); FileReader fileRead = new FileReader(inputFile); BufferedReader inputFileNew = new BufferedReader(fileRead); FileWriter fwriteToFile = new FileWriter(outputFile); PrintWriter outputFileNew = new PrintWriter(fwriteToFile); while ((writeToFile = inputFileNew.readLine()) != null) { System.out.println(writeToFile); writeToFile = inputFileNew.readLine(); String upper = writeToFile.toUpperCase(); System.out.println(upper); outputFileNew.println(upper); } inputFileNew.close(); outputFileNew.close(); } } How would I be able to do this program without the BufferedReader method?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
