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
Which technical practice incorporates build-time identification of security vulnerabilities in the code?
jonny [76]

Answer:

Penetration testing

<h3>What is Penetrating Testing?</h3>
  • A penetration test, colloquially known as a pen test or ethical hacking, is an authorized simulated cyberattack on a computer system, performed to evaluate the security of the system; this is not to be confused with a vulnerability assessment.

To learn more about it, refer

to brainly.com/question/22654163

#SPJ4

3 0
2 years ago
Can you solve these? My last two digits 86
boyakko [2]
Nothing is there ....
6 0
3 years ago
Read 2 more answers
Using only the sequential operations described in Section 2.2.2, write an algorithm that gets two values: the price for item A a
suter [353]

Answer:

total_cost = cost + tax

Explanation:

Step1) Let the 2 variable for take input from user e.g price and quantity

var price ;

var quantity ;

var cost ;

var tax ;

var total_cost ;

Step2) take input from user quantity of item 'A'

step3) cost = price * quantity

Step4) tax = 0.08 * cost

Step5) total_cost = cost + tax

Step6) print the total_cost

7 0
3 years ago
Approximately how many distributions of Linux are available in different forms and formats? A. 100 B. 200 C. 1,000 D. 2,000
ella [17]

Answer:

C.

Explanation:

I think it’s because it’s the best format

3 0
3 years ago
A large piece of ground is developed with lights, streets, and sewers. The subdivider wants to get it ready for building. He doe
VLD [36.1K]

Answer:

Subdivision plat map

Explanation:

A subdivision plat map is a map plan of a given scale having the planned lot subdivisions and amenities. Subdivision plat map also show easement boundaries, access routes, streets and alleyways present in or adjacent to the tract of land that is being subdivided into lots

The process of subdivision of a tract land of land requires the approval the counties and the cities in which the land is located.

4 0
4 years ago
Other questions:
  • What is the special thermodynamic meaning of the words adiabatic and aergonic? Give an example of a physical system/process wher
    8·1 answer
  • A heat engine is a device able to transform work into heat.<br> a. True<br> b. False
    13·1 answer
  • An average person produce 0.25 kg of moisture while taking a shower and 0.05 kg while bathing in a tub. Consider a family of fou
    7·1 answer
  • The force on a cutting tool are 2600N vertically downward and 2100 horizontal. Determine the resultant force acting on the tool
    12·1 answer
  • A vehicle of 1 200 kg is moving at a speed of 40 km/h on an incline of 1 in 50. The total constant rolling and wind resistance i
    15·1 answer
  • Explain how each of the following terms relate to the Bernoulli equation: a. static pressure b. dynamic pressure .stagnation pre
    8·1 answer
  • How do statics, Dynamics and Mechanics of materials differ from each other? *
    5·1 answer
  • Please help fast
    13·1 answer
  • 9. To forward bias an NPN transistor, the
    10·1 answer
  • Which type of astm c150 standard portland cement is best suited for a concrete where minimal total heat evolution and minimal ra
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!