Question: I need some help troubleshooting this code. I have pasted my code below. Any help would be appreciated! Here are the errors I am getting

I need some help troubleshooting this code. I have pasted my code below. Any help would be appreciated!

Here are the errors I am getting currently:

/tmp/java_KlM6w6/JavaApplication3.java:28: error: illegal start of expression public void execute(); ^ /tmp/java_KlM6w6/JavaApplication3.java:28: error: illegal start of expression public void execute(); ^ /tmp/java_KlM6w6/JavaApplication3.java:28: error: ';' expected public void execute(); ^ /tmp/java_KlM6w6/JavaApplication3.java:58: error: illegal start of expression public String displayMsg(String strMsg); ^ /tmp/java_KlM6w6/JavaApplication3.java:58: error: ';' expected public String displayMsg(String strMsg); ^ /tmp/java_KlM6w6/JavaApplication3.java:58: error: ';' expected public String displayMsg(String strMsg); ^ /tmp/java_KlM6w6/JavaApplication3.java:74: error: reached end of file while parsing } ^ 7 errors

/* * 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 javaapplication3;

import java.util.Scanner;

/** * * @author kinde */ public class JavaApplication3 {

/** * @param args the command line arguments */ public static void main(String[] args) { Scanner scnr = new Scanner(System.in);

new JavaApplication3().execute(); {

public void execute() { //Ask the user for input System.out.print("Enter text: "); Scanner scnr = new Scanner(System.in); String inString = scnr.nextLine();

//Show the user input System.out.print("You entered: "); System.out.println(inString);

String strMsg = displayMsg(inString); System.out.println();

if (inString.contains("IDK")) { System.out.println("Replaced \"IDK\"" + " with \"I don't know\"."); } else if (inString.contains("BFF")) { System.out.println("Replaced \"BFF\"" + " with \"Best friends forever\"."); } else if (inString.contains("JK")) { System.out.println("Replaced \"JK\"" + " with \"just kidding\"."); } else if (inString.contains("TMI")) { System.out.println("Replaced \"TMI\"" + "with \"too much informtion\"."); } else if (inString.contains("TTYL")) { System.out.println("Replaced \"TTYL\"" + "with \"talk to you later\"."); }

//Display the extended messsage System.out.print("Expanded: " + strMsg); }

public String displayMsg(String strMsg) String String = strMsg; String = String.replace("BFF", "best " + "friend forever");

String = String.replace("IDK", "I don't know");

String = String.replace("JK", "just kidding");

String = String.replace("TMI", "too much" + " information");

String = String.replace("TTYL", "talk to" + " you later");

return String ;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!