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

Please help. 3.15 Program: Text message expander (Java) A brief note from your i

ID: 3754661 • Letter: P

Question

Please help. 3.15 Program: Text message expander (Java) A brief note from your instructor: While you will be submitting this assignment through Zybooks, make sure you are still applying appropriate formatting and in-line commenting. Create a program using conditional logic and string operations that does the following using your NetBeans IDE and upload it here: (1) Use scnr.nextLine(); to get a line of user input into a string. Output that line. (1 pt) Ex: Enter text: IDK how that happened. TTYL. You entered: IDK how that happened. TTYL. (2) Expand common text message abbreviations. Output a message for each abbreviation that is expanded, then output the expanded line. Note: Check for abbreviations in the order provided below. (5 pts) Support these abbreviations (you only need to support these): BFF -- best friend forever IDK -- I don't know JK -- just kidding TMI -- too much information TTYL -- talk to you later Ex: Enter text: IDK how that happened. TTYL. You entered: IDK how that happened. TTYL. Replaced "IDK" with "I don't know". Replaced "TTYL" with "talk to you later". Expanded: I don't know how that happened. talk to you later. LAB ACTIVITY 3.15.1: Program: Text message expander (Java) 0 / 5 Submission Instructions Deliverables TextMsgExpander.java You must submit these file(s) Compile command javac TextMsgExpander.java -Werror We will use this command to compile your code Submit your files below by dragging and dropping into the area or choosing a file on your hard drive. TextMs....java Drag file here or Choose on hard drive. Submit for grading Latest submission No submissions yet

Explanation / Answer

// TextMessageExpander.java

import java.util.Scanner;
public class TextMessageExpander
{
public static void main(String[ ] args)
{
    String JK = "just kidding";
String BFF = "best friend forever";
String IDK = "I don't know";
String TTYL = "talk to you later";
String TMI = "too much information";

Scanner scan = new Scanner(System.in);
       String userInput;

System.out.println("Enter text: ");
userInput=scan.nextLine();

System.out.println("You entered: "+ userInput);
System.out.println();

if(userInput.contains("BFF"))
{
userInput=userInput.replace("BFF",BFF);
System.out.println("Replaced "BFF" with " + """ + BFF + """ + ".");
}

if(userInput.contains("IDK"))
{
userInput=userInput.replace("IDK",IDK);
System.out.println("Replaced "IDK" with " + """ + IDK + """ + ".");
}

if(userInput.contains("JK"))
{
userInput=userInput.replace("JK",JK);
System.out.println("Replaced "JK" with " + """ + JK + """ + ".");
}

if(userInput.contains("TMI"))
{
userInput=userInput.replace("TMI",TMI);
System.out.println("Replaced "TMI" with " + """ + TMI + """ + ".");
}

if(userInput.contains("TTYL"))
{
userInput=userInput.replace("TTYL",TTYL);
System.out.println("Replaced "TTYL" with " + """ + TTYL + """ + ".");
}

       System.out.println(" Expanded: "+userInput);
   }

}

/*
output:

Enter text:
IDK how that happened. TTYL.
You entered: IDK how that happened. TTYL.

Replaced "IDK" with "I don't know".
Replaced "TTYL" with "talk to you later".

Expanded: I don't know how that happened. talk to you later.

*/