Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package task3thatwillsbggingmetodo;
- /**
- *
- * @author Tom
- */
- public class Task3thatwillsbggingmetodo {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- AQAConsole2014 console = new AQAConsole2014();
- AQAReadTextFile2014 readFromFile = new AQAReadTextFile2014();
- AQAWriteTextFile2014 writeToFile = new AQAWriteTextFile2014();
- String filename = "words-format.txt";
- readFromFile.openTextFile(filename);
- int sentencecount = 0;
- String[] sentences = new String[10];
- String read;
- String br = "<br>";
- String tempString = "";
- do {
- read = readFromFile.readLine();
- if(br.equals(read)){
- sentences[sentencecount] = tempString;
- sentencecount++;
- tempString="";
- }else{
- tempString = tempString +read+" ";
- }
- } while (read != null);
- readFromFile.closeFile();
- int i;
- writeToFile.openFile("Paragraphs.txt");
- for(i=0;i<sentencecount;i++){
- writeToFile.writeToTextFile(sentences[i]);
- console.println(sentences[i]);
- }
- writeToFile.closeFile();
- console.println();
- console.println();
- console.println();
- console.println("THE ABOVE HAS BEEN SUCCESSFULLY WRITTEN TO THE FILE 'Paragraphs.txt' Thank you and Goodnight x");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement