// Convert all letters in input file to upper case. import java.io.FileReader; import java.io.PrintWriter; import java.io.FileNotFoundException; import java.util.Scanner; public class ToUpper { public static void main(String[ ] args) throws FileNotFoundException { // Define variables for input. String line; char x; // Get input and output file names. String inputFileName = args[0]; String outputFileName = args[1]; // Create Scanner object. //Scanner con = new Scanner(new FileReader(inputFileName)); Scanner con = new Scanner(new FileReader("raven.txt")); // Create PrintWriter object. PrintWriter pw = new PrintWriter(outputFileName); // Keep converting lines while not at end of file. while(con.hasNextLine( )) { // Get next line to convert. line = con.nextLine( ); // Convert letters one by one to uppercase. for(int i = 0; i < line.length( ); i++) { x = line.charAt(i); x = Character.toUpperCase(x); pw.print(x); } // Print new line characters "\r\n". pw.println( ); } // Close PrintWriter object to flush buffer. pw.close( ); } }