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
Technician A says that the paper test could detect a burned valve. Technician B says that a grayish white stain on the engine co
Bumek [7]

Answer:

Both Technician A and B are correct.

Explanation: Both are correct, but keep note that different color coolants leave different color  stains.

6 0
3 years ago
A 15-ft beam weighing 570 lb is lowered by means of two cables unwinding from overhead cranes. As the beam approaches the ground
7nadin3 [17]

Answer:

I. Tension (cable A) ≈ 6939 lbf

II. Tension (cable B) ≈ 17199 lbf

Explanation:

Let's begin by listing out the data that we were given:

mass of beam (m) = 570 lb, deceleration (cable A) = -20 ft/s², deceleration (cable B) = -2 ft/s²,

g = 32.17405 ft/s²

The tension on an object is given by the product of mass of the object by gravitational force plus/minus the product of mass by acceleration.

Mathematically represented thus:

T = mg + ma

where:

T = tension, m = mass, g = gravitational force,

a = acceleration

I. For Cable A, we have:

T = mg + ma = (570 * 32.17405) + [570 * (-20)]

T = 18339.2085 - 11400 = 6939.2085

T ≈ 6939 lbf

II. For Cable B, we have:

T = mg + ma = (570 * 32.17405) + [570 * (-2)]

T = 18339.2085 - 1140 = 17199.2085

T ≈ 17199 lbf

4 0
3 years ago
Match the scenario to the term it represents.
Ann [662]

Answer:

i nrfvewv

Explanation:

3 0
3 years ago
Need help with both giving out brainlest for the people to help me
sammy [17]
The first one is d or the 4th answer choice and the second one is false. Hope this helps!
4 0
3 years ago
Discuss in detail the following methods used to redistribute income and wealth in cash grants?​
aev [14]

Answer:

Redistribution of income and wealth is the transfer of income and wealth (including physical property) from some individuals to others through a social mechanism such as taxation, welfare, public services, land reform, monetary policies, confiscation, divorce or tort law.

-The term typically refers to redistribution on an economy-wide basis rather than between selected individuals.

Interpretations of the phrase vary, depending on personal perspectives, political ideologies and the selective use of statistics.

-It is frequently heard in politics, usually referring to perceived redistribution from those who have more to those who have less. Occasionally, however, it is used to describe laws or policies that cause opposite redistribution that shift monetary burdens from low-income earners to the wealthy.

-

The phrase is often coupled with the term class warfare, with high-income earners and the wealthy portrayed as victims of unfairness and discrimination.

-

Redistribution tax policy should not be confused with predistribution policies. "Predistribution" is the idea that the state should try to prevent inequalities from occurring in the first place rather than through the tax and benefits system once they have occurred. For example, a government predistribution policy might require employers to pay all employees a living wage, not just a minimum wage, as a "bottom-up" response to widespread income inequalities or high poverty rates.

Many alternate taxation proposals have been floated without the political will to alter the status quo. One example is the proposed "Buffett Rule", which is a hybrid taxation model composed of opposing systems, intended to minimize the favoritism of the special interest tax design.

7 0
2 years ago
Other questions:
  • The volume at a section of a 2-lane highway is 1800 vph in each direction and the density is approximately 30 bpm. A slow moving
    10·1 answer
  • A 5 MW gas turbine power plant is reported to have a thermodynamic efficiency of 35%. Assume products of the combustion reaction
    5·1 answer
  • Does the army good 4 you
    15·1 answer
  • What are the four basic parts of process plan
    11·1 answer
  • So in my settings i set it to send notifications too my email so ik when smtn happens but it doesn't even send stuff too it.....
    11·1 answer
  • What is the thermal efficiency of this reheat cycle in terms of enthalpies?
    11·1 answer
  • . Which of the following formula is used for calculating current:
    15·1 answer
  • ───────────────────────────────
    7·1 answer
  • What are the materials and tools used to build a headgear?​
    5·1 answer
  • which type of irrigation fluid is typically used for endoscopic procedures using monopolar electrosurgery
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!