Question

IN JAVA. P0\/\/|\|3D. In the early 80s, hackers used to write in an obfuscated, but mostly...

IN JAVA. P0\/\/|\|3D. In the early 80s, hackers used to write in an obfuscated, but mostly readable way called “leet” – short for “elite”.  In essence, it was a simple character replacement algorithm, where a single “regular” character was replaced by one or more “leet” characters; numbers remained the same.  Here’s one of the most readable versions:

a

4

g

9

m

/\\/\\

s

$

y

‘/

b

B

h

|-|

n

|\\|

t

7

z

Z

c

(

i

1

o

0

u

U

d

D

j

j

p

P

v

\\/

e

3

k

|<

q

Q

w

\\/\\/

f

Ph

l

L

r

R

x

><

Note! You will need to know how to 1) get the length of a string (the number of characters) and 2) access individual characters of the string.  See the appendix for more information.  You must use at least one method in addition to main – preferably one that translates individual characters! In JAVA

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Screenshot

tnter a teat for remui Flap Leet text of the given text is SLLDas import j.util.Seanner; public class LeetComversion public sProgram

//Import for input read
//Map for comparison
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class LeetConversion {

   public static void main(String[] args) {
       //Variable for leet text generation
       String leet="";
       //Scanner object for input read
       Scanner sc=new Scanner(System.in);
       //Prompt for input teaxt for conversion
       System.out.print("Enter a test for conversion: ");
       String text=sc.nextLine();
       //Call method to get length of the entered string
       int len=StringLength(text);
       //Loop unti end of the string to gete character by character
       for(int i=0;i<len;i++) {
           //Call method to get correspoding leet code
           String str=getLeet(text.charAt(i));
           //If function return a code then add it into the leet
           if(str!=null) {
               leet+=str;
           }
           //Otherwise same character add into leet
           else {
               leet+=text.charAt(i);
           }
       }
       //Display leet text
       System.out.println("Leet text of the given text is "+leet);
      
   }
   //Method to find length of the string
   public static int StringLength(String text) {
       return text.length();
   }
   //Method to find the leet form of a character
   public static String getLeet(char ch) {
       //MAp for mapping character and leet expression
       Map<Character,String> leetComp=new HashMap<Character,String>();
       leetComp.put('a',"4");
       leetComp.put('b',"B");
       leetComp.put('c',"(");
       leetComp.put('d',"D");
       leetComp.put('e',"3");
       leetComp.put('f',"Ph");
       leetComp.put('g',"9");
       leetComp.put('h',"|-|");
       leetComp.put('i',"1");
       leetComp.put('j',"j");
       leetComp.put('k',"|<");
       leetComp.put('l',"L");
       leetComp.put('m',"?/\\/\\");
       leetComp.put('n',"|\\|");
       leetComp.put('o',"O");
       leetComp.put('p',"P");
       leetComp.put('q',"Q");
       leetComp.put('r',"R");
       leetComp.put('s',"$");
       leetComp.put('t',"7");
       leetComp.put('u',"U");
       leetComp.put('v',"\\/");
       leetComp.put('w',"\\/\\/");
       leetComp.put('x',"><");
       leetComp.put('y',"'/");
       leetComp.put('z',"Z");
       //Loop for comparison
       for(char key:leetComp.keySet()){
           if(key==ch) {
               return leetComp.get(key);
           }
       }
       return null;
   }

}

------------------------------------------

Output

Enter a test for conversion: hello98
Leet text of the given text is |-|3LLO98

-----------------------------------------------

Note:

I assume you need the program this way

If you have any doubt, let me know

Add a comment
Know the answer?
Add Answer to:
IN JAVA. P0\/\/|\|3D. In the early 80s, hackers used to write in an obfuscated, but mostly...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Need in pseudocode Program 2: POWIN3D. In the early 80s, hackers used to write in an...

    Need in pseudocode Program 2: POWIN3D. In the early 80s, hackers used to write in an obfuscated, but mostly readable way called "leet" - short for "elite". In essence, it was a simple character replacement algorithm, whereya single "regular" character was replaced by one or more "leet" characters; numbers remained the same. Here's one of the most readable versions: g9m AS$y 00u | |р | P v II 9 IQ W LrRXI>< VI Note! You will need to know how...

  • Spell it out! Use the following Java concepts to compile the program below:   String myName =...

    Spell it out! Use the following Java concepts to compile the program below:   String myName = "Chuck";     int length = myName.length();     char firstChar = myName.charAt(0);     char secondChar = myName.charAt(1);     if (myName.equals("Tom")) {       System.out.println ("Sorry, Tom!");   } Write a program that uses a METHOD to translate these individual characters:   input output input output input output input output input output a 4 g 9 m /\\/\\ s $ y ‘/ b B h |-| n |\\| t...

  • Write a Java method that searches a 2-d array for a specific character. Return the index...

    Write a Java method that searches a 2-d array for a specific character. Return the index of the first location of the character. Method header: public static void play(char c, char[][]wordSearch){ Example: a e v s l g r e d k h k q s e z j c p o a t s o v a n m n l q p f o x b The character 's' appears at index 0,3.

  • Java... Write a program that has 4 separate threads. The threads will have the following arrays:...

    Java... Write a program that has 4 separate threads. The threads will have the following arrays: Thread1: A E I M Q U Y Thread2: B F J N R V Z Thread3: C G K O S W ThreadD: D H L P T X Your goal is to synchronize the threads in such a way that they print out all the letters of the alphabet in order.

  • Methods: Net beans IDE Java two methods. Identifier: calculateScore(String word) Parameters: word – the word for...

    Methods: Net beans IDE Java two methods. Identifier: calculateScore(String word) Parameters: word – the word for which you should calculate the points in Scrabble Return Value: int – the number of points for the parameter word Other: This method should be static. This method should use the following system for scoring: 0 – blank 1 – e, a, i, o, n, r, t, l, s, u 2 – d, g 3 – b, c, m, p 4 – f, h,...

  • I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I...

    I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I just have to explain a lot so you understand how the program should work. In C programming, write a simple program to take a text file as input and encrypt/decrypt it by reading the text bit by bit, and swap the bits if it is specified by the first line of the text file to do so (will explain below, and please let me...

  • You will be writing a simple Java program that implements an ancient form of encryption known...

    You will be writing a simple Java program that implements an ancient form of encryption known as a substitution cipher or a Caesar cipher (after Julius Caesar, who reportedly used it to send messages to his armies) or a shift cipher. In a Caesar cipher, the letters in a message are replaced by the letters of a "shifted" alphabet. So for example if we had a shift of 3 we might have the following replacements: Original alphabet: A B C...

  • CIST 2371 Introduction to Java Unit 03 Lab Due Date: ________ Part 1 – Using methods...

    CIST 2371 Introduction to Java Unit 03 Lab Due Date: ________ Part 1 – Using methods Create a folder called Unit03 and put all your source files in this folder. Write a program named Unit03Prog1.java. This program will contain a main() method and a method called printChars() that has the following header: public static void printChars(char c1, char c2) The printChars() method will print out on the console all the characters between c1 and c2 inclusive. It will print 10...

  • Please write code using Python. Rubric Assignment Solution Total: 100 pts Program successfully retrieves and validates...

    Please write code using Python. Rubric Assignment Solution Total: 100 pts Program successfully retrieves and validates user input 15 pts Morse Code Function Created 10 pts Function Uses Parameters to get input message 15 pts Function successfully converts passed message to Morse Code and returns the Morse Code equivalent of message 45 pts Program calls Morse Code function and outputs the result of the function (i.e. the actual Morse Code) 15 pts Main Function Requirement Part 2 MUST have a...

  • Program Description: A Java program is to be created to produce Morse code. The Morse code...

    Program Description: A Java program is to be created to produce Morse code. The Morse code assigns a series of dots and dashes to each letter of the alphabet, each digit, and a few special characters (such as period, comma, colon, and semicolon). In sound-oriented systems, the dot represents a short sound and the dash represents a long sound. Separation between words is indicated by a space, or, quite simply, the absence of a dot or dash. In a sound-oriented...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT