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 179 ‑turn circular coil of radius 3.95 cm and negligible resistance is immersed in a uniform magnetic field that is perpendicu
suter [353]

Answer:

The energy, that is dissipated in the resistor during this time interval is 153.6 mJ

Explanation:

Given;

number of turns, N = 179

radius of the circular coil, r = 3.95 cm = 0.0395 m

resistance, R = 10.1 Ω

time, t = 0.163 s

magnetic field strength, B = 0.573 T

Induced emf is given as;

emf= N\frac{d \phi}{dt}

where;

ΔФ is change in magnetic flux

ΔФ  = BA = B x πr²

ΔФ  = 0.573 x π(0.0395)² = 0.002809 T.m²

emf = N\frac{d \phi}{dt} = 179(\frac{0.002809}{0.163} ) = 3.0848 \ V

According to ohm's law;

V = IR

I = V / R

I = 3.0848 / 10.1

I = 0.3054 A

Energy = I²Rt

Energy = (0.3054)² x 10.1 x 0.163

Energy = 0.1536 J

Energy = 153.6 mJ

Therefore, the energy, that is dissipated in the resistor during this time interval is 153.6 mJ

6 0
3 years ago
HELP!
olya-2409 [2.1K]
The thickness is thick
5 0
3 years ago
You are designing the access control policies for a Web-based retail store. Customers access the store via the Web, browse produ
PolarNik [594]

Answer:

Object-Oriented Software Engineering Using UML, Patterns, and Java, 3e, shows readers how to use both the principles of software engineering and the practices of various object-oriented tools, processes, and products.

3 0
2 years ago
A large heat pump should upgrade 5 MW of heat at 85°C to be delivered as heat at 150°C. Suppose the actual heat pump has a COP o
AysviL [449]

Answer:

W=2 MW

Explanation:

Given that

COP= 2.5

Heat extracted from 85°C  

Qa= 5 MW

Lets heat supplied at 150°C   = Qr

The power input to heat pump = W

From first law of thermodynamics

Qr= Qa+ W

We know that COP of heat pump given as

COP=\dfrac{Qr}{W}

2.5=\dfrac{5}{W}

2.5=\dfrac{5}{W}

W=2 MW

For Carnot heat pump

COP=\dfrac{T_2}{T_2-T_1}

2.5=\dfrac{T_2}{T_2-(273+85)}

2.5 T₂ -  895= T₂

T₂=596.66 K

T₂=323.6 °C

7 0
3 years ago
Reverse masking forms a soft edge on the panel.
valina [46]
True I think I’m not sure?
7 0
1 year ago
Other questions:
  • How does fouling affects the performance of a heat exchanger?
    6·1 answer
  • If a steel cable is rated to take 800-lb and the steel has a yield strength of 90,000psi, what is the diameter of the cable?
    12·1 answer
  • After a 65 newton weight has fallen freely from rest a vertical distance of 5.3 meters, the kinetic energy of the weight is
    12·1 answer
  • The annual storage in Broad River watershed is 0 cm/y. Annual precipitation is 100 cm/y and evapotranspiration is 50 cm/y. The s
    10·2 answers
  • The goal of the Concept Selection phase is to (please choose the best answer): Group of answer choices
    10·1 answer
  • 37. In ______ combination of drugs, the effects of one drug cancel or diminish
    12·1 answer
  • Write a program to calculate overtime pay of 10 employees. Overtime is paid at the rate of Rs. 12.00
    13·1 answer
  • You filled a balloon that has a volume of 45 cm3 with helium gas. What is the volume of the helium gas?
    13·1 answer
  • Hey any one ride dirtbikes here
    5·2 answers
  • Which option identifies the free resource Judi can use in the following scenario?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!