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
An engineer designs a new bus that can drive 30 miles per gallon of fuel. Which of the following was likely one of the client’s
Marat540 [252]
What are the options?
7 0
3 years ago
Read 2 more answers
A cone penetration test was carried out in normally consolidated sand, for which the results are summarized below: Depth (m) Con
Cerrena [4.2K]

Answer:

hello your question is incomplete attached below is the missing equation related to the question  

answer : 40.389° , 38.987° , 38° , 39.869° , 40.265°

Explanation:

<u>Determine the friction angle at each depth</u>

attached below is the detailed solution

To calculate the vertical stress = depth * unit weight of sand

also inverse of Tan = Tan^-1

also qc is in Mpa while σ0 is in kPa

Friction angle at each depth

2 meters = 40.389°

3.5 meters  = 38.987°

5 meters = 38.022°

6.5 meters = 39.869°

8 meters = 40.265°

6 0
3 years ago
What type of bridge is the sunshine skyway bridge?
sdas [7]

Answer:

That's either a cable-stayed bridge or a cantilever bridge

6 0
3 years ago
You are ordering steel cable for a 250 foot long zip-line you are building in your back yard. The cable can be ordered in diamet
Margarita [4]

Answer:

If i am correct It should be 1/4 of an inch

Explanation:

Sorry but i can't quite explain

3 0
3 years ago
Read 2 more answers
What type of slab and beam used in construction of space neddle​
Sav [38]

jrjrkeekkekekkwkkakkllalllalallalllalalaallalalaalalalalalallallallllallalalallaaallalallllllallllllllalaalalalaaaaalalaaaaaaalgjgiejxpwunfifjruritiririirieoeowowowowowowowowooeowowowoeeoeowowowowowowowoowowwowowowoozoeisiaokseekxidjdkdjfidjfjdjfjfjrifjrifjdirjdjrjfjrjfjrjfjrfuejwwuxmaneanfjkaosndjxieneamalhaqzeeshanvhorahfuensiwjakaksjdhfhfnfhfndjxnxmakaalalalwlwlwwow

5 0
3 years ago
Other questions:
  • When the outside temperature is 5.2 ⁰C, a steel beam of cross-sectional area 52 cm2 is installed in a building with the ends of
    8·1 answer
  • For a p-n-p BJT with NE 7 NB 7 NC, show the dominant current components, with proper arrows, for directions in the normal active
    14·1 answer
  • Water, in a 150 in^3 rigid tank, initially has a temperature of 70°F and an enthalpy of 723.5 Btu/lbm. Heat is added until the w
    13·1 answer
  • The kinetic energy correction factor depends on the (shape — volume - mass) of the cross section Of the pipe and the (velocity —
    11·1 answer
  • A satellite is launched 600 km from the surface of the earth, with an initial velocity of 8333.3 m./s, acting parallel to the ta
    14·1 answer
  • Windmills slow the air and cause it to fill a larger channel as it passes through the blades. Consider a circular windmill with
    10·1 answer
  • Convert mechanical energy into electric energy. What can he use?
    13·1 answer
  • Reduce the force F ij = + (2 5 ) kN to point A(2m,3m) that acts on point B( 3m,5m) - .
    9·1 answer
  • What is a chipping hammer used for? <br><br> State three things.
    7·2 answers
  • R-744 refrigerant is bad why
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!