Many user-created passwords are simple and easy to guess. Using java language, write a program that takes a simple password and makes it stronger by replacing characters using the key below, and by appending "!" to the end of the input string. i becomes 1 a becomes @ m becomes M B becomes 8 s becomes $
Many user-created passwords are simple and easy to guess. Using java language, write a program that takes a simple password and makes it stronger by replacing characters using the key below, and by appending "!" to the end of the input string.
- i becomes 1
- a becomes @
- m becomes M
- B becomes 8
- s becomes $
The string will be taken by the user using Scanner class or BufferedReader Class.
The taken string will be traversed character by character and when an I is found, its replaced by 1 and so on. As the code is in java, Java provides a function replace() in string and it can be used for each character replacement
In java, the string are concatenated by + sign itself. So at the end, the string +'!' operation will append a ! at the end and output the required string.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps