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
Exhaust gas from a furnace is used to preheat the combustion air supplied to the furnace burners. The gas, which has a flow rate
Monica [59]

Answer:

The total tube surface area in m² required to achieve an air outlet temperature of 850 K is 192.3 m²

Explanation:

Here we have the heat Q given as follows;

Q = 15 × 1075 × (1100 - t_{A2}) = 10 × 1075 × (850 - 300) = 5912500 J

∴ 1100 - t_{A2} = 1100/3

t_{A2}  = 733.33 K

\Delta \bar{t}_{a} =\frac{t_{A_{1}}+t_{A_{2}}}{2} - \frac{t_{B_{1}}+t_{B_{2}}}{2}

Where

\Delta \bar{t}_{a} = Arithmetic mean temperature difference

t_{A_{1} = Inlet temperature of the gas = 1100 K

t_{A_{2} = Outlet temperature of the gas = 733.33 K

t_{B_{1} =  Inlet temperature of the air = 300 K

t_{B_{2} = Outlet temperature of the air = 850 K

Hence, plugging in the values, we have;

\Delta \bar{t}_{a} =\frac{1100+733.33}{2} - \frac{300+850}{2} = 341\tfrac{2}{3} \, K = 341.67 \, K

Hence, from;

\dot{Q} = UA\Delta \bar{t}_{a}, we have

5912500  = 90 × A × 341.67

A = \frac{5912500  }{90 \times 341.67} = 192.3 \, m^2

Hence, the total tube surface area in m² required to achieve an air outlet temperature of 850 K = 192.3 m².

4 0
3 years ago
Which of the following is the last step in creating a budget?
Greeley [361]

Answer:

<em>D. Determine saving or debt</em>

Explanation:

7 0
3 years ago
Maximum iorsional shear siress.? Select one: a)- occurs at the center of a shaft. b)- occurs at the outer surface of a shaft c)-
pickupchik [31]

Answer:

b). Occurs at the outer surface of the shaft

Explanation:

We know from shear stress and torque relationship, we know that

\frac{T}{J}= \frac{\tau }{r}

where, T = torque

            J = polar moment of inertia of shaft

            τ = torsional shear stress

             r = raduis of the shaft

Therefore from the above relation we see that

            \tau = \frac{T.r}{J}

Thus torsional shear stress, τ is directly proportional to the radius,r of the shaft.

When r= 0, then τ = 0

and when r = R , τ is maximum

Thus, torsional shear stress is maximum at the outer surface of the shaft.

4 0
4 years ago
A pump operating at steady state receives liquid water at 20°C, 100 kPa with a mass flow rate of 53 kg/min. The pressure of the
VARVARA [1.3K]

Answer:

Input Power = 6.341 KW

Explanation:

First, we need to calculate enthalpy of the water at inlet and exit state.

At inlet, water is at 20° C and 100 KPa. Under these conditions from saturated water table:

Since the water is in compresses liquid state and the data is not available in compressed liquid chart. Therefore, we use approximation:

h₁ = hf at 20° C = 83.915 KJ/kg

s₁ = sf at 20° C = 0.2965 KJ/kg.k

At the exit state,

P₂ = 5 M Pa

s₂ = s₁ = 0.2965 K J / kg.k    (Isentropic Process)

Since Sg at 5 M Pa is greater than s₂. Therefore, water is in compresses liquid state. Therefore, from compressed liquid property table:

h₂ = 88.94 KJ/kg

Now, the total work done by the pump can be calculated as:

Pump Work = W = (Mass Flow Rate)(h₂ - h₁)

W = (53 kg/min)(1 min/60 sec)(88.94 KJ/kg - 83.915 KJ/kg)

W = 4.438 KW

The efficiency of pump is given as:

efficiency = η = Pump Work/Input Power

Input Power = W/η

Input Power = 4.438 KW/0.7

<u>Input Power = 6.341 KW</u>

5 0
3 years ago
Fire andwater ______(do/does) not agree​
Elina [12.6K]

Answer:

<em><u>Hii</u></em><em><u> </u></em><em><u>Dear</u></em><em><u> </u></em><em><u>!</u></em><em><u>!</u></em><em><u>!</u></em><em><u> </u></em>

<em><u>How</u></em><em><u> are</u></em><em><u> you</u></em><em><u> </u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em>

<em><u>I</u></em><em><u> </u></em><em><u>hop</u></em><em><u>e</u></em><em><u> </u></em><em><u>That</u></em><em><u> </u></em><em><u>you</u></em><em><u> are</u></em><em><u> </u></em><em><u>Fine</u></em><em><u> </u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em>

Explanation:

<em><u>So</u></em><em><u> </u></em><em><u>the</u></em><em><u> </u></em><em><u>answer</u></em><em><u> </u></em><em><u>is</u></em><em><u> </u></em><em><u>_</u></em><em><u>_</u></em><em><u>d</u></em><em><u>o</u></em><em><u>e</u></em><em><u>s</u></em><em><u>_</u></em><em><u>_</u></em><em><u>_</u></em><em><u>_</u></em><em><u>_</u></em>

3 0
3 years ago
Other questions:
  • A transformer winding contains 900 turns of wire which creates 400 ohms of primary importance how many terms of the same size wi
    8·1 answer
  • WHAT IS A TOROID IN HYDRAULUCS?
    11·2 answers
  • Energy that causes a transfer of heat between marterials
    13·1 answer
  • Plz help me
    12·1 answer
  • A car generator turns at 400 rpm (revolutions per minute) when the engine is idling. It has a rectangular coil with 300 turns of
    7·1 answer
  • In order to fill a tank of 1000 liter volume to a pressure of 10 atm at 298K, an 11.5Kg of the gas is required. How many moles o
    11·1 answer
  • Were women treated as equals to men in early aviation history?
    14·2 answers
  • Identify three questions a patient might ask of the nuclear medicine technologist performing a nuclear medicine exam.
    11·1 answer
  • A sprinter reaches his maximum speed in 2.5sec from rest with constant acceleration. He then maintains that speed and finishes t
    15·1 answer
  • A bakery wants to determine how many trays of doughnuts it should prepare each day. Demand is normal with a mean of 15 trays and
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!