Question

In: Computer Science

Search the web to discover the 10 most common user-selected passwords, and store them in an...

Search the web to discover the 10 most common user-selected passwords, and store them in an array. Design a JAVA program that prompts a user for a password, and continue to prompt the user until the user has not chosen one of the common passwords.

Solutions

Expert Solution

Solution:

Look at the code and comments for better understanding...............

Screenshot of the code:

Output:

Code to copy:

import java.util.Scanner;
class Solution
{
        //Store the 10 most common passwords in the array
        //I obtained the passwords from internet
        private static String[] common_pass = {"123456","123456789","qwerty","password","111111",
                                                                                "12345678","abc123","1234567","password1","12345"};
        //a function that takes a password and checks if it is present in the array or not
        public static boolean isNotCommon(String password)
        {
                for(int i=0;i<common_pass.length;i++)
                {
                        //if the password is present in the array return false
                        if(common_pass[i].equals(password))
                                return false;
                }
                //return true if the password is not in the array
                return true;
        }
        public static void main(String[] args)
        {
                Scanner sc = new Scanner(System.in);
                String password;
                //read untill user enters a un common password
                while(true){
                        System.out.print("Enter a Password : ");
                        password = sc.nextLine();
                        //if password is not common break
                        if(isNotCommon(password))
                        {
                                System.out.println("Password Accepted..");
                                break;
                        }
                        System.out.println("Password is too common..");
                }
        }
}

I hope this would help.........................:-))

If you have any doubts please let me know in the comments...............:-))


Related Solutions

Search the web to discover the ten most common user-selected passwords, and store them in an...
Search the web to discover the ten most common user-selected passwords, and store them in an array. -Draw a flowchart and pseudocode for a program that prompts a user for a password, and continue to prompt the user until the user has not chosen one of the common passwords. Make a working version of this program in Python. ( need correct code )
Social bookmarking is a way for people to store, organize, search and manage “bookmarks” of web...
Social bookmarking is a way for people to store, organize, search and manage “bookmarks” of web pages.  Explain how this can benefit an entrepreneur.
Reusable Passwords The most common authentication credential is the reusable password, which is a string of...
Reusable Passwords The most common authentication credential is the reusable password, which is a string of characters that a user types to gain access to the resources associated with a certain username (account) on a computer. These are called reusable passwords because the user types the password each time he or she needs access to the resource. Unfortunately, the reusable password is the weakest form of authentication, and it is appropriate only for the least sensitive assets.Ease of Use and...
Answer the Following Question using Web: a) Use web search to identify and name 10 university...
Answer the Following Question using Web: a) Use web search to identify and name 10 university groups in USA and Canada with research programs in the area of VLSI design. Pick two research groups of your choice. b)Use web search to find open source libraries for VLSI design components. List the type of designs available there. Give description of one design you find in these libraries. NOTE: Can You please explain with details, thank You.
Write a C program that asks the user to enter 15 integer numbers and then store them in the array.
Write a C program that asks the user to enter 15 integer numbers and then store them in the array. Then, the program will find the second largest element in array and its index without sorting the array. For example, In this array {-55,-2,1, 2, -3, 0, 5, 9, 13, 1, 4, 3, 2, 1, 0}, the second largest element is 9 [found at index 7].
Answer the following question thank You •Q1: Use web search to identify and name 10 university...
Answer the following question thank You •Q1: Use web search to identify and name 10 university groups in USA and Canada with research programs in the area of VLSI design. Pick two research groups of your choice.
What would be some good user requirements (At least 10) for a furniture store database? An...
What would be some good user requirements (At least 10) for a furniture store database? An example would be: For employees: - Must have access to the order history of a customer. - Needs to be able to find out the most popular product.
1. Four most common layout formats (170, PPT 4-10) – describe the four most common layout...
1. Four most common layout formats (170, PPT 4-10) – describe the four most common layout formats. 2. workcenter (Job shop) Layout (170-174, PPT 11-20) – for a given workcenter layout, be able to assess the material handling cost/distance. 3. Assembly Line Layout (174-180, PPT 21-40) – be able to balance an assembly line: 1) draw a precedence diagram, 2) determine the workstation cycle time, 3) determine the theoretical minimum number of workstations, 4) using the longest task time rule...
Customer reviews are now a common feature of consumer Web sites, most notably, Amazon. How do...
Customer reviews are now a common feature of consumer Web sites, most notably, Amazon. How do private sector Web sites keep outrageous and/or malicious comments off their product review pages (or discourage such comments from being posted)? Do a search on “Amazon General Review Creation Guidelines” and consider how these techniques could be used by the CPSC.
Search online and find the most recent Big Mac Index and make a list of 10...
Search online and find the most recent Big Mac Index and make a list of 10 countries including US. Which currencies are over valued and which under valued (if any)? Provide a possible explanation of why a selected currency is over valued.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT