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 piston-cylinder device contains 0.8 kg of steam at 300°C and 1 MPa. Steam is cooled at constant pressure until one-half of the
liberstina [14]

The answer & explanation for this question is given in the attachment below.

8 0
3 years ago
what are the characteristics of an ideal fluid the general relation between shear stress and velocity gradient​
Dafna11 [192]

Answer:

ideal fluid follow Newtonian law

that is, shear stress is directly proportional to rate change of shear strain.

watch handwritten explanation

6 0
3 years ago
The enforcement of OSHA standards is provided by federal and state
Gnoma [55]

Answer:

Explanation:

Enforcing OSHA, Occupational Safety and Health Administration, standards is not a job for electricians, lawmakers or tax collectors. The right answer is safety inspectors.

3 0
2 years ago
Show that for a linearly separable dataset, the maximum likelihood solution for the logisitic regression model is obtained by fi
KATRIN_1 [288]

Answer:

Answer for the question:

"Show that for a linearly separable dataset, the maximum likelihood solution for the logisitic regression model is obtained by finding a weight vector w whose decision boundary wx. "

is explained in the attachment.

Explanation:

8 0
3 years ago
Ammonia contained in a piston-cylinder assembly, initially saturated vapor at 0o F, undergoes an isothermal process during which
Rudik [331]

ANSWERS:

-P_{2(a)} =15.6lbf/in^2\\-P_{2(b)} =30.146lbf/in^2\\ T_{2(a)} =0^oF\\T_{2(b)} =0^oF\\x_{2(b)} =49.87percent

Explanation:

Given:

Piston cylinder assembly which mean that the process is constant pressure process P=C.

<u>AMMONIA </u>

state(1)

saturated vapor x_{1} =1

The temperature T_{1} =0^0 F

Isothermal process  T=C

a)

-V_{2} =2V_{1} ( double)

b)

-V_{2} =.5V_{2} (reduced by half)

To find the final state by giving the quality in lbf/in we assume the friction is neglected and the system is in equilibrium.

state(1)

using PVT data for saturated ammonia

-P_{1} =30.416 lbf/in^2\\-v_{1} =v_{g} =9.11ft^3/lb

then the state exists in the supper heated region.

a) from standard data

-v_{1(a)} =2v_{1} =18.22ft^3/lb\\-T_{1} =0^oF

at\\P_{x} =14lbf/in^2\\-v_{x} =20.289 ft^3/kg

at\\P_{y} =16 lbf/in^2\\-v_{y} =17.701ft^3/kg

assume linear interpolation

\frac{P_{x}-P_{2(b)}  }{P_{x}- P_{y} } =\frac{v_{x}-v_{1(a)}  }{v_{x}-v_{y}  }

P_{1(b)}=P_{x} -(P_{x} -P_{y} )*\frac{v_{x}- v_{1(b)} }{v_{x}-v_{y}  }\\ \\P_{1(b)} =14-(14-16)*\frac{20.289-18.22}{20.289-17.701} =15.6lbf/in^2

b)

-v_{2(a)} =2v_{1} =4.555ft^3/lb\\v_{g}

from standard data

-v_{f} =0.02419ft^3/kg\\-v_{g} =9.11ft^3/kg\\v_{f}

then the state exist in the wet zone

-P_{s} =30.146lbf/in^2\\v_{2(a)} =v_{f} +x(v_{g} -v_{f} )

x=\frac{v_{2(a)-v_{f} } }{v_{g} -v_{f} } \\x=\frac{4.555-0.02419}{9.11-0.02419} =49.87%

3 0
3 years ago
Other questions:
  • Consider two electrochemical reaqctions. Reaction A results in the transfer of 2 mol of electrons per mole of reactant and gener
    14·2 answers
  • What is the maximum number of 12-2 with ground nonmetallic-sheathed cables permitted in an 18-cubic-inch device box if two singl
    11·2 answers
  • A Transmission Control Protocol (TCP) connection is in working order and both sides can send each other data. What is the TCP so
    7·1 answer
  • 12. Dies are turned using a special tool called a/an
    10·1 answer
  • What is a coarse-grained rock composed of intermediate plagioclase feldspar and pyroxene? a. graniteb. gabbro c. andesited. peri
    9·1 answer
  • What’s a pnp transitor?
    5·2 answers
  • What type of drawing would civil engineers use if they needed to show an
    11·1 answer
  • A structural component in the shape of a flat plate 29.6 mm thick is to be fabricated from a metal alloy for which the yield str
    11·1 answer
  • सत्य से अधिक उपयोगी एवं आज्ञापालन से श्रेष्ठ क्या है ?<br>answer fast plz​
    9·1 answer
  • What are the reasons why fine grained of alkali igneous rocks can not be used in cement
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!