Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

socialist egalitarianism which resulted in wage levelling;

Answered: 1 week ago

Question

soyuznye (all-Union, controlling enterprises directly from Moscow);

Answered: 1 week ago