Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a Java application program that can check a password to see whether it is really secure. This program is like a passwond game.

image text in transcribed
image text in transcribed
image text in transcribed
Please write a Java application program that can check a password to see whether it is really secure. This program is like a passwond game. If the password is not secure, your program must report all the security violations. Please see the following test case 1 to design your application program. You must stop your program when the password from the user is quit. You need to use scan.nextline) to get the complete password You must write 7 methods to check the following 7 rules for a secure password. Rule 1: Length inwalid-The length of the password must be 8 to 12 only. Rule 2: No Space The password must not contain any space or blank character Rule 3: At least 2 digits- The passwoed must contain at least 2 Rule 4: At least 1 upper-case letter-The password must contain at least one upper-case letter Rule 5: At least 1 lower-case letter-The password must contain at least one lower case letter Rule 6: At least 1 special character The password must contain at least one special character, which can be one of the following 7 choices: $or T Rule 7: No special numbers-The password must not contain any of the following 4 numbers: 2019, 2018, 2017, or 2016. The following is a sample standard test, which m ust be your case E1. You must also do test case 2 and test case 3 with different set of input data. Each test case must test at least 5 passwwords with 2 secure and 3 non-secure. All those 7 violations must appear in those 3 non-secure passwords Welcome to play the Password same! Please enter a password>007 The passwerd 007 violates the following rules Rule 1: Length iewalid-The length of the passwoed must be 8 to 12 Rule 2 No Space The password must not contain any space or blank character. Rule 4: At least 2 upper-case letter-The password must contain at least one upper-case letter Rule Sc At least 1 lower-case letter- The password must contain at least one lower case letter, Rule 6 At least 1 special character-The password must contain at least one special character, which can be one of the following 7 choices: $7, or T Please enter a password> $007SLin Congratulations! Your password "5007SLin" is very secure Please enter a password #1SimonLin The password .#1SimonLin-violates the following rule Rule 3 At least 2 digits- The password must contain at least 2 Please enter a password> SLin20190 Pleave enter a password>SLin2019 ule 7:No special numbers-The password must not contain any of the following4 numbers: 2019 2018 2017 or 2016 Please enter a password $2020Wis Congratulation, Your password xuwin' is very secret Please enter a password q Thank you for playing the Password gome Hope to see you oon! The folowing is a sample code wilth some pseude-code inside for this Password Game program package Package C$236: import java ut publk class C$236 Lab1 static String pw global variable to hold password for security checking static boolean 123dret77 nules' satisfaction indicators true I fabe public statk vold mainStringa 17 begin of main) Scanner scan- new Scanner System int System outprintrease enter a pas , pw.scannextLieb #scan toget paiswordinpw System.outYou just entered password satished Irprint secure password message,/ else & insecure password because at least one nule got violabed 1#print allthe violated rules Cri)prine rule 1 " f Dr2)print nule 27 r3) print rule 3" Cr4)/prine rule 47 if(YS)/-print rule S ": ifDr7)/-print rule7.1 ; print all the violated nules l # end of main) The following are 7 static methods to check those 7 nules static void s10 r2-talseif check ri jri-te: static void s20 2-talseilcheck 12 12-true:7 18 end of main) The following are 7 static methods to check those 7 muless static vold s10 r1-false:check ri ok)rntrue: "/ static void s20{ r2.false; /. if(check r2 aklr2.true static void s30(r3-false:" i(check r3 k3 true: static void s50{ rS-false: / lcheck rSk) rS.true-/ ] static void sOrb-false: /. if(check r6 akl r6"trwtn static void s700r7-false;"i(check7 ok)7true: end of class Passwond W You may use the following ideas for upper/lower case character checking thru Z upper case String specialChars "-see&.?!": # 7 special characters Some other usefull functions to be used are as follows pw.contains("2019.) wil return true if pw contains 2019. pw.containswill return true if pw contains a blank character pwlengthl) will return the length of the string pw You may need to use some String methods such as chanAt subitring, length contains, or indexOf Aspecial technique to check for the Rule 3 (At least 2 digits in password) is as follows static void s3) &static method for this program {/begin of s3( ) method #for Rule 3 checking charc: int countDigits: String digits 012345672 countDigits O: set O as the current count of digits in the r3 fase: & set r3 to false in the beginning forl int i 0: i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions

Question

Complexity of linear search is O ( n ) . Your answer: True False

Answered: 1 week ago