Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Download: http://solutionzip.com/downloads/inputoutput/
- Write a program which reads a file and creates a file with the same contents of all lower case letters. Keep in mind that other characters are not affected.
- Create your own file to test your program. Your job is to set up the input and output files to have the program read from a file and write to a file. Here is a basic program that will accomplish what is desired:
- import java.io.*;
- class InputOutput
- {
- public static void main(String args[])throws Exception
- {
- FileReader fr = new FileReader(“Exercise03.in”);
- FileWriter fw = new FileWriter(“Exercise03.out”);
- Answer6
- int ch;
- ch = fr.read();
- while(ch != -1)
- {
- if((char)ch>=’A’ && (char)ch<=’Z')ch = ch +(‘a’-'A’);
- fw.write((char)ch);
- ch = fr.read();
- }
- fr.close();
- fw.close();
- }
- }
- Download: http://solutionzip.com/downloads/inputoutput/
Add Comment
Please, Sign In to add comment