Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with this Java Program and creating a GUI for the program. Please in

ID: 3776008 • Letter: I

Question

I need help with this Java Program and creating a GUI for the program. Please include comments throughout. Thanks

Write a program that checks a text file for several formatting and punctuation matters. The program asks for the names of both an input file and an output file. lt then copies all the text from the input file to the output file but with the following two changes: 1) Any string of two or more blank characters is replaced by a single blank. 2) All sentences start with an uppercase letter. All sentences after the first one begin after either a period, a question mark, or an exclamation mark that is followed by one or more whitespace characters. Programming Project as described in p 790 3 Create GUI using JFrame

Explanation / Answer

/* ReplaceCharacters .java */

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class ReplaceCharacters {
   public static void main(String[] args)throws IOException {
  
      
       BufferedReader br = null;

       try {

           String l_CurrentLine;

           br = new BufferedReader(new FileReader("Give your path")); //C:\Users\Name\Desktop\1.txt Example like this

           while ((l_CurrentLine = br.readLine()) != null) { //Reading the line
              
               if(l_CurrentLine.length()>0)//if length is >0
               {

l_CurrentLine= l_CurrentLine.replaceAll("\s+", " "); //Replace more than one space with single space
                   l_CurrentLine= l_CurrentLine.replace(".", " "); //Replacing .(Period with single space)
                   l_CurrentLine= l_CurrentLine.replace("!", " ");//Replacing !(Period with single space)
                   l_CurrentLine= l_CurrentLine.replace("?", " ");//Replacing ?(Period with single space)
                  
               }
              
               System.out.println("Final text-->"+l_CurrentLine);//line by line print text
           }

       } catch (IOException e) {
           e.printStackTrace();
       }
       finally {
      
           try {
               if (br != null)br.close();//Close buffer
           }
           catch (IOException ex) {
               ex.printStackTrace();//Printing exception
           }
       }

  
       }
  
}

Expected output

Input text

Ss.adsj jjs?hjs k kjhjk.hj!kh
Lsdaldj? kljsdla!! ljkldjsf.
Adsfdsdsfs dsfds!f dsfdsff?!lkd;fads

Final Output

Final text-->Ss adsj jjs hjs k kjhjk hj kh
Final text-->Lsdaldj kljsdla ljkldjsf
Final text-->Adsfdsdsfs dsfds f dsfdsff lkd;fads