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
A 1.5-kg specimen of a 90 wt% Pb-10 wt% Sn alloy (Animated Figure 9.8) is heated to 250°C; at this temperature it is entirely an
Alex17521 [72]

Answer:

A. By hit and trial method 280 C

Explanation:

ion know B sorry

6 0
2 years ago
simple Brayton cycle using air as the working fluid has a pressure ratio of 10. The minimum and maximum temperatures in the cycl
Irina18 [472]

Answer:

a) 764.45K

b) 210.48 kJ/kg

c) 30.14%

Explanation:

pressure ratio = 10

minimum temperature = 295 k

maximum temperature = 1240 k

isentropic efficiency for compressor = 83%

Isentropic efficiency for turbine = 87%

<u>a) Air temperature at turbine exit </u>

we can achieve this by interpolating for enthalpy

h4 = 783.05 kJ/kg ( calculated in the background ) at state 4 using Table A-17  for  Ideal gas properties of air

T4 ( temperature at Turbine exit ) = 760 + ( 780 - 760 ) (\frac{783.05-778.18}{800.13-778.18} ) = 764.45K

<u>b) The net work output </u>

first we determine the actual work input to compressor

Wc = h2 - h1  ( calculated values )

     = 626.57 - 295.17 =  331.4 kJ/kg

next determine the actual work done by Turbine

Wt = h3 - h4  ( calculated values )

     = 1324.93 - 783.05 = 541.88 kJ/kg

finally determine the network output of the cycle

Wnet = Wt - Wc

         = 541.88 - 331.4  = 210.48 kJ/kg

<u>c) determine thermal efficiency </u>

лth = Wnet / qin  ------ ( 1 )

where ; qin = h3 - h2

<em>equation 1 becomes </em>

лth = Wnet / ( h3 - h2 )

      = 210.48 / ( 1324.93 - 626.57 )

      = 0.3014  =  30.14%

6 0
3 years ago
A tool used to drive and pull out nails​
Tju [1.3M]

Answer:

claw hammer

Explanation:

A claw hammer is a tool used for driving nails into an object or pulling nails from some other object.

6 0
2 years ago
Read 2 more answers
I WILL GIVE 20 POINTS!!
Alex777 [14]

Answer:

Use a resume header

Explanation:

Create a Summary

Research industry, employer keywords

there are some hints okay

5 0
3 years ago
Read 2 more answers
Which of the following is true about how the universe is expanding?
Law Incorporation [45]
B. The space between the galaxy is getting better
4 0
4 years ago
Read 2 more answers
Other questions:
  • The 150-lb man sits in the center of the boat, which has a uniform width and a weight per linear foot of 3 lb&gt;ft. Determine t
    9·1 answer
  • A meter stick can be read to the nearest millimeter and a travelling microscope can be read to the nearest 0.1 mm. Suppose you w
    11·1 answer
  • I'm not sure if its true
    5·2 answers
  • A person with a Class C drivers license may operate
    5·1 answer
  • Write a script (Program 2) to perform t he following matrix operations. Use output commands to clearly output each problem with
    15·1 answer
  • Proper grain stress/strain analysis is required in solid motor design: A. To ensure good motor structure B. To avoid surface cra
    11·1 answer
  • Does it jiggle? Does it really jiggle jiggle?
    9·2 answers
  • A TRF receiver is to be designed with a single tuned circuit using an 8.2 uH inductor. If the frequency is to be tuned from 55 k
    11·1 answer
  • Does any1 know TERMS OF MEASUREMENT
    12·2 answers
  • What is the optimal temperature for recharging a battery?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!