akosiraff

Download InputOutput

Apr 19th, 2015
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1.  
  2. Download: http://solutionzip.com/downloads/inputoutput/
  3. 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.
  4. 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:
  5. import java.io.*;
  6. class InputOutput
  7. {
  8. public static void main(String args[])throws Exception
  9. {
  10. FileReader fr = new FileReader(“Exercise03.in”);
  11. FileWriter fw = new FileWriter(“Exercise03.out”);
  12. Answer6
  13. int ch;
  14. ch = fr.read();
  15. while(ch != -1)
  16. {
  17. if((char)ch>=’A’ && (char)ch<=’Z')ch = ch +(‘a’-'A’);
  18. fw.write((char)ch);
  19. ch = fr.read();
  20. }
  21. fr.close();
  22. fw.close();
  23. }
  24. }
  25. Download: http://solutionzip.com/downloads/inputoutput/
Add Comment
Please, Sign In to add comment