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. A 3-kg plastic tank that has a volume of 0.2 m^3 is lled with liquid water. Assuming the density of water is 1000 kg=m^3, det
Tpy6a [65]

Answer:

The answer is below

Explanation:

a) The weight of the combined system is the sum of the weight of the water and the weight of the tank

m_{water}=V_{tank}.\rho_{wtaer}\\\\m_{water}=0.2m^3*1000kg/m^3\\\\m_{water}=200 \ kg\\\\m_{total} = m_{water}+m_{tank}\\\\But\ m_{tank}=3kg,therefore:\\\\m_{total} =200kg+3kg\\\\m_{total} =203\ kg\\\\weight_{total}=m_{total}g\\\\weight_{total}=203kg*9.81m/s^2\\\\weight_{total}=1991.43\ N

b) Since the weight of a system can be divided into smaller portions, hence weight is an extensive property.

c) When analyzing the acceleration of gases as they flow through a nozzle, the geometry of the nozzle which is an open system can be chosen as our system.

d) Given that:

\rho_{water}=1000kg/m^3\\\\1kg/m^3=0.062428lb/ft^3\\\\1000kg/m^3=1000kg/m^3*\frac{0.062428lb/ft^3}{kg/m^3}=62.43lb/ft^3\\ \\\rho=SG*\rho_{water}=1.03*62.43=64.272lb/ft^3\\\\P=P_{atm}+\rho g H\\\\P=14.7\ psia+64.272\ lb/ft^3*32.2\ ft/s^2*175\ ft*\frac{1\ ft^2}{12^2\ in^2}*\frac{1\ lbf}{32.2\ lbm.ft/s^2}  \\\\P=92.8\ psia

6 0
3 years ago
The pads are 200mm long, 150 mm wide and thickness equal to 12mm. 1- Determine the average shear strain in the rubber if the for
lord [1]

Answer:

a) 0.3

b) 3.6 mm

Explanation:

Given

Length of the pads, l = 200 mm = 0.2 m

Width of the pads, b = 150 mm = 0.15 m

Thickness of the pads, t = 12 mm = 0.012 m

Force on the rubber, P = 15 kN

Shear modulus on the rubber, G = 830 GPa

The average shear strain can be gotten by

τ(average) = (P/2) / bl

τ(average) = (15/2) / (0.15 * 0.2)

τ(average) = 7.5 / 0.03

τ(average) = 250 kPa

γ(average) = τ(average) / G

γ(average) = 250 kPa / 830 kPa

γ(average) = 0.3

horizontal displacement,

δ = γ(average) * t

δ = 0.3 * 12

δ = 3.6 mm

5 0
4 years ago
he circular stream of water from a faucet is observed to taper from a diameter of 21 mm to 12 mm in a distance of 52 cm. Determi
Gemiola [76]

Answer: 1.52 × 10^{-3} \frac{m^{3} }{s}

Explanation:

Please kindly find the attached document for the answer.

5 0
3 years ago
What’s the difference between quality and quantity
Lesechka [4]
Quality is how good something is. Like how good the material is. Like the quality of the IPhone X is better than the quality of the iPhone 6s + because it has more features and can sustain better hold
Quantity is how much. Like the quantity of the m&ms were split evenly.
I dont know exactly if that makes sense but there ya go
YW!
4 0
3 years ago
Read 2 more answers
A plate (A-C) is connected to steelflat bars by pinsat A and B. Member A-E consists of two 6mm by 25mm parallel flat bars. At C,
juin [17]

Answer:

stress_ac = 5.333 MPa

shear stress_c = 1.763 MPa

Explanation:

Given:

- The missing figure is in the attachment.

- The dimensions of member AC = ( 6 x 25 ) mm x 2

- The diameter of the pin d = 19 mm

- Load at point A is P = 2 kN

Find:

-  Find the axial stress in AE and the shear stress in pin C.

Solution:

- The stress in member AE can be calculated using component of force P along the member AE  as follows:

                                    stress_ac = P*cos(Q) / A_ae

Where, Angle Q: A_E_B   and A_ac: cross sectional area of member AE.

                                    cos(Q) = 4 / 5   ..... From figure ( trigonometry )

                                    A_ae = 0.006*0.025*2 = 3*10^-4 m^2

Hence,

                                    stress_ae = 2*(4/5) / 3*10^-4

                                    stress_ae = 5.333 MPa

- The force at pin C can be evaluated by taking moments about C equal zero:

                                   (M)_c = P*6 - F_eb*3

                                      0 = P*6 - F_eb*3

                                      F_eb = 0.5*P

- Sum of horizontal forces for member AC is zero:

                                      P - F_eb - F_c = 0

                                      F_c = 0.5*P

- The shear stress of double shear bolt is given by an expression:

                                     shear stress = shear force / 2*A_pin

Where, The area of the pin C is:

                                     A_pin = pi*d^2 / 4

                                     A_pin = pi*0.019^2 / 4 = 2.8353*10^-4 m^2

Hence,

                                     shear stress = 0.5*P / 2*A_pin

                                     shear stress = 0.5*2 / 2*2.8353*10^-4

                                    shear stress = 1.763 MPa

7 0
3 years ago
Other questions:
  • Which of the following is not a primary or fundamental dimension? (a)-mass m (b)-length L (c)- timer t (d)-volume V
    5·1 answer
  • Pick a subjectarea/field/topic that you are interested in. For each of the following Bonham- Carver uses of GIS give an example
    7·1 answer
  • Q5. A hypothetical metal alloy has a grain diameter of 2.4 x 10-2 mm. After a heat treatment at 575°C for 500 min, the grain dia
    7·1 answer
  • How much work is performed if a 400 lb weight is lifted 10 ft ?
    8·1 answer
  • Question 11 (1 point)
    12·1 answer
  • Select the correct answer
    8·1 answer
  • This just a question that I keep forgetting, are lightskin people black.??
    6·2 answers
  • Answer the question faster please
    7·1 answer
  • Can somebody help me with that
    13·1 answer
  • The static weight distribution is changed laterally by
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!