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
Describe the are of mechanical engineering
posledela

Answer:

Mechanical engineering is an engineering discipline that combines engineering physics and mathematics principles with materials science to design, analyze, manufacture, and maintain mechanical systems.

5 0
3 years ago
Read 2 more answers
Assuming that the following three variables have already been declared, which variable will store a Boolean value after these st
Yuki888 [10]

Answer:

C

Explanation:

Boolean Algebra deals with either a one or a zero and how to manipulate them in computers or elsewhere. The "choice" option may not work, since for text it must be enclosed in quotation marks, usually. For "again," it's text and not a 1 or 0. So, the answer is C, since this is a 0.

5 0
3 years ago
Homes may be heated by pumping hot water through radiators. What mass of water (in g) will provide the same amount of heat when
Nitella [24]

Answer:

a mass of water required is mw= 1273.26 gr = 1.27376 Kg

Explanation:

Assuming that the steam also gives out latent heat, the heat provided should be same for cooling the hot water than cooling the steam and condense it completely:

Q = mw * cw * ΔTw = ms * cs * ΔTw + ms * L

where m = mass , c= specific heat , ΔT=temperature change, L = latent heat of condensation

therefore

mw = ( ms * cs * ΔTw + ms * L )/ (cw * ΔTw )

replacing values

mw = [182g * 2.078 J/g°C*(118°C-100°C) + 118 g * 2260 J/g ] /[4.187 J/g°C * (90.7°C-39.4°C)] = 1273.26 gr = 1.27376 Kg

3 0
3 years ago
Calculate the number of atoms per cubic meter in Metal B (units atoms/m^3). Write your answer with 4 significant figures metal:
Iteru [2.4K]

Answer:

7,217*10^28 atoms/m^3

Explanation:

  • Metal: Vanadium
  • Density: 6.1 g/cm^3
  • Molecuar weight: 50,9 g/mol

The Avogadro's Number, 6,022*10^23, is the number of atoms in one mole of any substance. To calculate the number of atoms in one cubic meter of vanadium we write:

1m^3*(100^3 cm^3/1 m^3)*(6,1 g/1 cm^3)*(1 mol/50,9g)*(6,022*10^23 atoms/1 mol)=7,217*10^28 atoms

Therefore, for vanadium we have 7,217*10^28 atoms/m^3

6 0
3 years ago
It is an important part of the differential maintenance which purpose is to make smoother the differential operation by lubricat
masha68 [24]

Answer:

lubrication

Explanation:

MARK ME BRAINLEIST

4 0
2 years ago
Other questions:
  • To 3 significant digits, what is the change of entropy of air in kJ/kgk if the pressure is decreased from 400 to 300 kPa and the
    15·1 answer
  • Give an example of how the fields of science, technology, and mathematics are commonly used when building a highway.
    7·1 answer
  • Calculate the potential energy in kJ of a human body (70 kg) possesses on top of the Empire State Building (1,250 ft tall).
    7·1 answer
  • The equation for the velocity V in a pipe with diameter d and length L, under laminar condition is given by the equation V=Δpdsq
    10·1 answer
  • What have you learned about designing solutions? How does this apply to engineering? Think of some engineering solutions that st
    15·1 answer
  • Explain with examples:<br> What are the reasons of a successful and unsuccessful software project?
    8·1 answer
  • For a nozzle-duct system shown in Fig Q3, the nozzle is designed to produce a Mach number of 2.8 with y = 1.4, The inlet conditi
    14·1 answer
  • An ideal Diesel Cycle has a compression ratio of 18 and a cutoff ratio of 1.5. Determine the maximum air temperature and the rat
    14·1 answer
  • The regulator is closed when the adjusting screw is turned in (clockwise).
    15·1 answer
  • You insert a dielectric into an air-filled capacitor. How does this affect the energy stored in the capacitor?.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!