Categories

JAVA DATEBASE
Technology Network Community
Oracle Database
Fusion Middleware
Development Tools
Java
Desktop
Server & Storage Systems
Enterprise Management
Berkeley DB Family
Cloud Computing
Big Data
Business Intelligence
Architecture
Migration and Modernization
E-Business Suite
Siebel
PeopleSoft Enterprise
JD Edwards World
Industries
JD Edwards EnterpriseOne
User Productivity Kit Pro (UPK) and Tutor
Governance, Risk & Compliance (GRC)
Master Data Management (MDM)
Oracle CRM On Demand
On Demand: SaaS and Managed Applications
AutoVue Enterprise Visualization
Primavera
ATG
Agile PLM
Endeca Experience Management
Fusion Applications
Archived Forums

 



Tags

New To Java


Uppercase file converter?


I tried, but it seemed that there is a problem with the following codes. Can you please help me to write the correct one to create the uppercase file converter? Thank you!!   import java.util.Scanner;     // Needed for the Scanner class import java.io.*;             // Needed for file classes  public class Uppercase2 {     public static void main(String[] args) throws IOException     { 		String filename;         String filename2;         String writing;          // Create a Scanner object for keyboard input.         Scanner keyboard = new Scanner(System.in);          // Get the first filename.         System.out.print("Enter the first filename: ");         filename = keyboard.nextLine();          // get the second filname         System.out.print("Enter the second filename: ");         filename2 = keyboard.nextLine();          // Open the reading file.         FileReader freader = new FileReader(filename);         BufferedReader inputFile = new BufferedReader(freader);          // open output file         FileWriter fwriter = new FileWriter(filename2);         PrintWriter outputFile = new PrintWriter(fwriter);          //writing = inputFile.readLine();          while ((writing = inputFile.readLine()) != null)         {                System.out.println(writing);           // writing = inputFile.readLine();             String upper = writing.toUpperCase();             System.out.println(upper);             outputFile.println(upper);         }          // close IO streams         outputFile.close();         inputFile.close();     } }

1. Use  code tags so that your code will be readable. Copy and paste from your original source, NOT from your post here, highlight the code, and click the CODE button.  2. As a specific question. "How do I do this?" or "It doesn't work," are not concrete enough for anybody to help you.  3. If this is related to your other thread, pick ONE to be the active thread, and provide a link to it in the other thread. It's very annoying to have the discussion split across multiple threads and to have people repeat each others' answers.

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 files. The second file will be a copy of the first file, except that all the characters will be uppercase. Use Notepad or another text editor to create a simple file that can be used to test the program.  import java.util.Scanner;     // Needed for the Scanner class import java.io.*;             // Needed for file classes   public class Uppercase2 {     public static void main(String[] args) throws IOException     { 		String filename;         String filename2;         String writing;           // Create a Scanner object for keyboard input.         Scanner keyboard = new Scanner(System.in);           // Get the first filename.         System.out.print("Enter the first filename: ");         filename = keyboard.nextLine();           // get the second filname         System.out.print("Enter the second filename: ");         filename2 = keyboard.nextLine();           // Open the reading file.         FileReader freader = new FileReader(filename);         BufferedReader inputFile = new BufferedReader(freader);               // open output file         FileWriter fwriter = new FileWriter(filename2);         PrintWriter outputFile = new PrintWriter(fwriter);           //writing = inputFile.readLine();                  while ((writing = inputFile.readLine()) != null)         {                System.out.println(writing);                                   // writing = inputFile.readLine();             String upper = writing.toUpperCase();             System.out.println(upper);             outputFile.println(upper);         }                      // close IO streams         outputFile.close();         inputFile.close();     } } 

Okay. Code formatting is good now. So did you have a question about that code? If so it would be a good idea to ask it now.

kyorochan wrote: 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 files. The second file will be a copy of the first file, except that all the characters will be uppercase. Use Notepad or another text editor to create a simple file that can be used to test the program.  And your question is...?

I'm sorry. I tried now, and it worked! I couldn't make the sentences in my text file uppercase before, so I wanted to ask you, but the problem has solved.  I was unable to see the good result yesterday... I don't know why.  I really appreciate your help! Thank you very much!


Related Links

how to use a Singleton to open a TCP port
Java, adding a new piece of code?
Student PostGraduate Class
program
help need to know hashcode() and Equals method
ArrayIndexOutOfBoundsException - help debug ?
searching for a string
Basic question: passing information
how to read openproj(Projity) file i.e. ,POD file(Project Management file)
constructor initalization lists
Having trouble passing user input to the constructor
How do you stop a JTextArea from expanding
Escape variables in strings
initialize other class
Multiplying a double...
Mystery Clock