Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package task3thatwillsbggingmetodo;
  7.  
  8. /**
  9. *
  10. * @author Tom
  11. */
  12. public class Task3thatwillsbggingmetodo {
  13.  
  14. /**
  15. * @param args the command line arguments
  16. */
  17. public static void main(String[] args) {
  18. AQAConsole2014 console = new AQAConsole2014();
  19. AQAReadTextFile2014 readFromFile = new AQAReadTextFile2014();
  20. AQAWriteTextFile2014 writeToFile = new AQAWriteTextFile2014();
  21. String filename = "words-format.txt";
  22. readFromFile.openTextFile(filename);
  23. int sentencecount = 0;
  24. String[] sentences = new String[10];
  25. String read;
  26. String br = "<br>";
  27. String tempString = "";
  28. do {
  29. read = readFromFile.readLine();
  30. if(br.equals(read)){
  31. sentences[sentencecount] = tempString;
  32. sentencecount++;
  33. tempString="";
  34. }else{
  35.  
  36. tempString = tempString +read+" ";
  37. }
  38. } while (read != null);
  39. readFromFile.closeFile();
  40.  
  41. int i;
  42. writeToFile.openFile("Paragraphs.txt");
  43. for(i=0;i<sentencecount;i++){
  44. writeToFile.writeToTextFile(sentences[i]);
  45. console.println(sentences[i]);
  46.  
  47. }
  48. writeToFile.closeFile();
  49. console.println();
  50. console.println();
  51. console.println();
  52. console.println("THE ABOVE HAS BEEN SUCCESSFULLY WRITTEN TO THE FILE 'Paragraphs.txt' Thank you and Goodnight x");
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement