1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
exis [7]
3 years ago
7

Write a program that prompts for a line of text and then transforms the text based on chosen actions. Actions include reversing

the text and converting the text to leet-speak. You may be able to imagine extending to other actions such as a pig-latin translator, or encoding or decoding a secret message. Turn in the version specified here before extending Welcome to the Text Converter Available Actions 1337) convert to 1337-speak rev) reverse the string quit) exit the progranm Please enter a string: Hello cs 200. Action (1337, rev, quit): rev 002 Sc olleH Action (1337, rev, quit): reverse again Unrecognized action. 002 Sc olleH Action (1337, rev, quit): rev ?? 11 CS 200. Action (1337, rev, quit): quit See you next time!
Engineering
1 answer:
nlexa [21]3 years ago
7 0

Answer:

public class TextConverterDemo

{

//Method definition of action1337

public static String action1337(String current)

{

//Replace each L or l with a 1 (numeral one)

 current = current.replace('L', '1');

 current = current.replace('l', '1');

 

 //Replace each E or e with a 3 (numeral three)

 current = current.replace('E', '3');

 current = current.replace('e', '3');

 //Replace each T or t with a 7 (numeral seven)

 current = current.replace('T', '7');

 current = current.replace('t', '7');

 //Replace each O or o with a 0 (numeral zero)

 current = current.replace('O', '0');

 current = current.replace('o', '0');

 

//Replace each S or s with a $ (dollar sign)

 current = current.replace('S', '$');

 current = current.replace('s', '$');

 return current;

}

//Method definition of actionReverse

//This method is used to reverses the order of

//characters in the current string

public static String actionReverse(String current)

{

 //Create a StringBuilder's object

 StringBuilder originalStr = new StringBuilder();

 //Append the original string to the StribgBuilder's object

 originalStr.append(current);

 //Use reverse method to reverse the original string

 originalStr = originalStr.reverse();

 

 //return the string in reversed order

 return originalStr.toString();

}

//Method definition of main

public static void main(String[] args)

{

    //Declare variables

 String input, action;

 

 //Prompt the input message

 System.out.println("Welcome to the Text Converter.");

 System.out.println("Available Actions:");

 System.out.println("\t1337) convert to 1337-speak");

 System.out.println("\trev) reverse the string");

 System.out.print("Please enter a string: ");

   

 //Create a Scanner class's object

 Scanner scn = new Scanner(System.in);

 

 //Read input from the user

 input = scn.nextLine();

 do

 {

  /*Based on the action the user chooses, call the appropriate

   * action method. If an unrecognized action is entered then

   * the message "Unrecognized action." should be shown on a

   * line by itself and then the user is prompted again just

   * as they were when an action was performed.

   * */

  System.out.print("Action (1337, rev, quit): ");

  action = scn.nextLine();

  if (action.equals("1337"))

  {

   input = action1337(input);

   System.out.println(input);

  } else if (action.equals("rev"))

  {

   input = actionReverse(input);

   System.out.println(input);

  } else if (!action.equals("quit"))

  {

   System.out.println("Unrecognized action.");

  }

 } while (!action.equals("quit"));

 System.out.println("See you next time!");

 scn.close();

}

}

You might be interested in
The __________________ refers to the main screen of the computer.
Sedbober [7]

Answer:

<em>D</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em>

Explain:

<em>Desktop refers to the main screen of the computer. It is the first screen you see after logging in. The desktop’s appearance can vary widely because it is highly customizable, but generally desktops will feature a large image, icons, and a taskbar(covered later on this page).</em>

4 0
2 years ago
A fixed mass of saturated water vapor at 400 kpa is isothermally cooled until it is a saturated liquid. Calculate the amount of
Kazeer [188]
This is the explanation

6 0
3 years ago
8. Describe and correct the error in stating the domain. Xf * (x) = 4x ^ (1/2) + 2 and g(x) = - 4x ^ (1/2) The domain of (f + g)
konstantin123 [22]

Answer:

hi

Explanation:

4 0
3 years ago
Almost all collisions are due to driver error
blondinia [14]

Answer:

Where's the questaion?

4 0
2 years ago
Let f(t) be an arbitrary signal with bandwidth Ω. Determine the minimum sampling frequencies ωs needed to sample the following a
disa [49]

Answer:

See explaination

Explanation:

We can describr Aliasing as a false frequency which one get when ones sampling rate is less than twice the frequency of your measured signal.

please check attachment for the step by step solution of the given problem.

7 0
3 years ago
Other questions:
  • A commercial refrigerator with refrigerant -134a as the working fluid is used to keep the refrigerated space at -30C by rejectin
    10·3 answers
  • A composite wall consists of 20 mm thick steel plate backed by insulation brick (k = 0.39 W/mK) of 50 cm thickness and overlaid
    6·1 answer
  • The head difference between the inlet and outlet of a 1km long pipe discharging 0.1 m^3/s of water is 0.53 m. If the diameter is
    11·1 answer
  • A computer maintenance company wants to 'capture' the knowledge that employees carry around in their heads by creating a databas
    5·1 answer
  • How an AK 47 gun was works​
    14·1 answer
  • Easy POINTS computer genius help me plz
    6·1 answer
  • What considerations are included in the Preliminary Floodproofing/Retrofitting Preference Matrix?
    7·1 answer
  • Which of the following is part of the highway
    11·2 answers
  • El tiempo hasta que falle un sistema informático sigue una distribución Exponencial con media de 600hs. (Utilice 3 decimales par
    13·1 answer
  • A particular cloud-to-ground lightning strike lasts 500 µµsec and delivers 30 kA across a potential difference of 100 MV. Assu
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!