Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Text message abbreviation decoder (Java) (1) Complete the following method: /** * Decodes the text abbreviation. * * @param textAbbr Text abbreviation. * @return The

Text message abbreviation decoder (Java)

(1) Complete the following method:

/** * Decodes the text abbreviation. * * @param textAbbr Text abbreviation. * @return The decoded abbreviation if known. Otherwise, returns Unknown. */ public static String decTextAbbr(String textAbbr) { // FILL IN BODY }

If the parameter matches a known text message abbreviation, return the unabbreviated form, else return: Unknown. Support two abbreviations:

LOL -- laughing out loud, and

IDK -- I don't know.

For example:

decTextAbbr("LOL") 

returns

laughing out loud

(2) Write a testing method to verify this method works for all expected inputs:

/** * Runs tests on the decTextAbbr method. */ public static void testDecTextAbbr() { System.out.println( "decTextAbbr(\"LOL\") expected 'laughing out loud', actual '" + decTextAbbr("LOL") + "'"); System.out.println( /* FIX ME */); System.out.println( /* FIX ME */); } 

Run this test method from the main method to verify the decTextAbbr method is working correctly.

(3) Expand the method to also decode these abbreviations.

  • IMHO -- in my humble opinion
  • TMI -- too much information
  • BFF -- best friends forever
  • ROFL -- rolling on floor laughing
  • LMK -- let me know

extend the testDecTextAbbr() method to also verify these cases work correctly. When complete, your testDecTextAbbr() method should have at least 6 tests.

TextMsgExpander.java

public class TextMsgExpander { /* Add your methods here */ public static void main(String[] args) { } }

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

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

Discuss the role of social class in developing marketing strategies

Answered: 1 week ago