@@ -0,0 +1,1964 @@
+/**%0A * A program that changes a line of text.%0A */%0A%0Apackage changetext;%0A%0A/**%0A *%0A * @author k8port%0A */%0Aimport java.util.Scanner;%0Aimport java.io.FileInputStream;%0Aimport java.io.FileNotFoundException;%0A%0Apublic class ChangeText %7B%0A%0A    /**%0A     * @param args the command line arguments%0A     */%0A    public static void main(String%5B%5D args) %7B%0A        %0A        // declare variables%0A        Scanner jim, jane;%0A        String text, chgText, fileTxt, chgFileTxt;%0A        %0A        // gather input from console%0A        jim = new Scanner(System.in);%0A        System.out.println(%22Write a sentence with the word %5C%22hate%5C%22.%22);%0A        text = jim.nextLine();%0A        %0A        // change string from console%0A        int pos = text.indexOf(%22hate%22);%0A        String ending = text.substring(pos + %22hate%22.length());%0A        chgText = text.substring(0, pos) + %22 love %22 + ending; %0A        %0A        System.out.println(%22From console: %22);%0A        System.out.println(%22The line of text to be changed is: %22);%0A        System.out.println(text);%0A        System.out.println(%22I have rephrased the line to read: %22);%0A        System.out.println(chgText);%0A        %0A        // gather input from file%0A        try %7B%0A            jane = new Scanner(new FileInputStream(%22chg.txt%22));%0A            fileTxt = jane.nextLine();%0A            // change string from file%0A            int pos2 = fileTxt.indexOf(%22hate%22);%0A            String fileEnd = fileTxt.substring(pos2 + %22hate%22.length());%0A            chgFileTxt = fileTxt.substring(0, pos2) + %22love%22 + fileEnd;%0A            // output result%0A            System.out.println(%22From file: %22);%0A            System.out.println(%22The line of text to be changed is: %22);%0A            System.out.println(text);%0A            System.out.println(%22I have rephrased the line to read: %22);%0A            System.out.println(chgText);%0A            %0A        %7D catch (FileNotFoundException e) %7B%0A            System.out.println(%22File not found.%22);%0A            System.exit(0);%0A        %7D%0A        %0A    %7D%0A    %0A%7D%0A

Create ChangeText.java