Question

**IN JAVA** Many user-created passwords are simple and easy to guess. Write a program that takes...

**IN JAVA** Many user-created passwords are simple and easy to guess. Write a program that takes a simple password and makes it stronger by replacing characters using the key below, and by appending "q*s" to the end of the input string.

  • i becomes !
  • a becomes @
  • m becomes M
  • B becomes 8
  • o becomes .

Ex: If the input is:

mypassword

the output is:

[email protected]*s
0 0
Add a comment Improve this question Transcribed image text
Answer #1
import java.util.Scanner;

public class PasswordModifier {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String password = in.nextLine();
        String modified = "";
        for(int i = 0; i < password.length(); ++i) {
            if(password.charAt(i) == 'i') {
                modified += "!";
            } else if(password.charAt(i) == 'a') {
                modified += "@";
            } else if(password.charAt(i) == 'm') {
                modified += "M";
            } else if(password.charAt(i) == 'B') {
                modified += "8";
            } else if(password.charAt(i) == 'o') {
                modified += ".";
            } else {
                modified += password.charAt(i);
            }
        }
        modified += "q*s";
        System.out.println(modified);
    }

}

mypassword Myp@ssw.rdq*s Process finished with exit code 0

Add a comment
Know the answer?
Add Answer to:
**IN JAVA** Many user-created passwords are simple and easy to guess. Write a program that takes...
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
  • 4.16 LAB: Password modifier Many user-created passwords are simple and easy to guess. Write a program...

    4.16 LAB: Password modifier Many user-created passwords are simple and easy to guess. Write a program that takes a simple password and makes it stronger by replacing characters using the key below, and by appending "q*s" to the end of the input string. • i becomes ! • a becomes @ • m becomes M • B becomes 8 • o becomes Ex: If the input is: mypassword the output is: Mypassw.rdq*s Hint: Python strings are immutable, but support string concatenation. Store and build the stronger password in the given password...

  • Write a password cracker program for the passwords created according to the policy outlined in assignment...

    Write a password cracker program for the passwords created according to the policy outlined in assignment 15 (exactly 8 characters: 5 letters and 3 digits). You are to write a function that takes one parameter that is a hash of a password and should return a possible password (a string) that has the same hash. Use python secure hash function sha1 from hashlib module. Hint: brute force method will be more than adequate to the task.   Please I need it...

  • For this lab you will write a Java program that plays a simple Guess The Word...

    For this lab you will write a Java program that plays a simple Guess The Word game. The program will prompt the user to enter the name of a file containing a list of words. These words mustbe stored in an ArrayList, and the program will not know how many words are in the file before it starts putting them in the list. When all of the words have been read from the file, the program randomly chooses one word...

  • Write a simple java program that takes input from the user as a fully parenthesized expression...

    Write a simple java program that takes input from the user as a fully parenthesized expression and converts it to a binary tree. Ex: (1+2 * (6-4)) or (A+B / (D-C)) When the tree is built, it should print the tree in some way.

  • Write a Java program which takes a string as a user input. Create 2 functions. The...

    Write a Java program which takes a string as a user input. Create 2 functions. The first function expects a string as argument and returns void. It converts all upper case characters to lower case and converts all lower case characters to upper case. It then prints out the converted string to a console. The second function also expects a string as argument and returns void. It will find first charactor that is repeated exactly 2 times in the string....

  • Write a program that takes in a line of text as input, and outputs that line...

    Write a program that takes in a line of text as input, and outputs that line of text in reverse. You may assume that each line of text will not exceed 50 characters. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is: Hello there Hey quit then the output is: ereht olleH уен Hint: Use the fgets function to read a string with spaces from the user...

  • PYTHON 1.Guessing many passwords: Write a function called guess_passwords. It doesn't take any arguments. It should use the function guess, trying out as many possible passwords as possible. Here...

    PYTHON 1.Guessing many passwords: Write a function called guess_passwords. It doesn't take any arguments. It should use the function guess, trying out as many possible passwords as possible. Here are some methods you might try: Try out a hardcoded list of strings that you think people might use as passwords. Try out all words in the word file. Try out all character combinations of length 4 or less (or more if you don't mind waiting). Try out combinations of words...

  • Write a Java Program to allow a user to guess a person’s age until they get...

    Write a Java Program to allow a user to guess a person’s age until they get it correct. After each guess, the user must be told whether their guess was correct, too high or too low. Once the user enters the correct age, the program must display how many guesses it took the user to guess the correct age.

  • This project will use The Vigenere Cipher to encrypt passwords. Simple letter substitution ciphers are ones...

    This project will use The Vigenere Cipher to encrypt passwords. Simple letter substitution ciphers are ones in which one letter is substituted for another. Although their output looks impossible to read, they are easy to break because the relative frequencies of English letters are known. The Vigenere cipher improves upon this. They require a key word and the plain text to be encrypted. Create a Java application that uses: decision constructs looping constructs basic operations on an ArrayList of objects...

  • Write a program that asks the user to enter a password, and then checks it for...

    Write a program that asks the user to enter a password, and then checks it for a few different requirements before approving it as secure and repeating the final password to the user. The program must re-prompt the user until they provide a password that satisfies all of the conditions. It must also tell the user each of the conditions they failed, and how to fix it. If there is more than one thing wrong (e.g., no lowercase, and longer...

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