Answered step by step
Verified Expert Solution
Question
1 Approved Answer
intro to Visuai Progromming - cs 114/15140 5torm-Page 1 Project 4-Password Checker Figure 1 Figam ? In this praject you will use the decision and
intro to Visuai Progromming - cs 114/15140 5torm-Page 1 Project 4-Password Checker Figure 1 Figam ? In this praject you will use the decision and repatitian centrol structures to create a passward checker that verifins a userentered password meets the requirements of being a user-defined minimum length, having are capital letter, having ane lowercase letter, having ane number, having one spocial character and does rot include a spaco. Objectives: - Use of itjelse it/else statement (decision structure) - Ranclom number generation - Use of ncsted and "block" if - Use of inputHox - Use of relational \& lopical opefators - Parsine stringe - Use of a flag - Use of chars - Use of loop (repetition structure) - Use of A5CII values - Use af listbox - Usa of intTryparse Requirements: - User will enter a valiel number of 4 or more for a minimum password length - this is the minimum number of charsters a password MUST cantsin c A messige box saying Flease enter a valid number of 4 or more for Minimum Fassword Length will bo displayed if the number is either invalid (not a number at alli or has a value under 4 - User will enter a passward and the pragrarn will check to eqsure it is valid: c Passwurd indst be s= the minimun required passwerd lengdh - If the actual password length daes not meat the minimum required pasword length the user will be ertdlessly prompted te re-eriter a password until it does (Fii 2) c. The passavard (randomly generated or user-entered) will be checked ta e7sura at least 1 af each of the following is used: - Minimum choroter requiremant met - Capital letter - Lnencrose letter - Nurnber - Spacial character that is nat a spacc - Acenerate button will rancomly create a valid password meeting length and valid password criteria - During the passward chacking process the fallowing line will be sdded to a listbox Fig 1) for each passward HINTS character cherked: While there are several ways to aparoach this project, tha first thing to remember how ta eat an elnphant. The second is - Pesition /SC VI Value A5CI velues to consider the following... - When finished checking tha password - You will need to ibentify and declare the following variablas - If ary characters were a space - irtRequiredPassLeri; //Required nurnber of chars for password (trin of 4) - A MeseageBax will notlfy the user that cpaces are not allowed - intictualPassien: // Actual length of passward entered by the user - "A Spece is NOT a valid special character", "No Spacus Allowed' - strPass; /iuser entered passourd - The passward taktbce will be deared - chrPassChar = ' '; / /individual charocter in user-entered possward - irtaSCIIVal://ASCIl value of char - If nane of the characters were spaces the pragram will display either a checkmark or x next to the - You will also need to declare and check several flags for this project such as: - binhascap - bintlaskum - blnHas5pecialChar etc. - Once yoa have declared your variables you will need to start by checking the userentered Minimam Passward length - Create an if statement with an int.TryParse - Use logical aperatars to tost far bath valid number and entered number heirg groater than/oqual to user entered minimum passavard langth - If beth are true, all validatian code will fit snuggly in the if - If cither are false, the clsa will display the errar message and you can assume the user entered a salece for the password - Next, get the actual length of the user-entered password and compare it to the required minirn lergth - Use while loop with an inputtox to reassign the actual password length variable - Once the pessword mieets the user-eritered Mirimum Password Length ar mare vou can trip the blnlsValidlength flag - With the leneth of the password known fultill the - Use a for laop starting at positicn 0 and iterating though each character of the password - Get the character's Asci value - Check each possible valid condition its it capital, is it a space, etc] one-by-one tripoing the flag if true - Use logical operators to check the range of the indlvid.al gassword character against the ASCIl value for number, capital, lowercase, and special characters - Use the not operator inegation! to check for a space - While you are bopine through each character of the password, enter the required Information int the listbox - Once you have leoped through each charscter of the password, tripped the flags and populated the listbox, use an if structure to sec if a space was part af the passward - If it was, show the required MassageBax - If it was not, update the checknark/x pics based on tha flage intre to Wisuai progroniming - CS 114/57140 5torm-Paye 4 - For the Generate Fassword butten - Create a strPassword variable to hold the generated password - Chovse one of the 4 required character (capital, lower case, etcl 6 Randoml Y generate a number in the range carresponding to the ASCil value of that character - Corivert that ASCll value to a char - Concatenate that thar ta the strfessword variable - Repeat 2 more tirnes, the strPassword variable will have a length of 3 curitaining 3 of the 4 required characterz - You'll have to figure cut the rest keeping the folluwing in mind - Yau will need a leap relating to the required minimum length af the peasword - In the laop you will be A.SCIl generating, character canwertin', and string concatenating until the minimum passwerd recuirement is mat - Yau will set the text praperty af the passward textbox to the generated password The program outline (If your pragram structure does not look like this, you might be ouer-complicating it]: WDeclare local variales and get user input for required password length and the password to he checked if required password length was an actual number >=4// use a tryiparse here get actual passward langth do whie actual password length \& required password length prempt user to enter another passward and theck actual password length again // input box for x=v to actual password length get char at x comvert char to ASC.II Check A5CIl value to ACSI table Tria flags 5uch as if AsII value is hetween 65 and 90 , bln HasCap = true Add position, char and ascii value to listbox If Display output if has space messageaor "No 5paces allowed in password" else check flags such as if binHascap show the image indicating the entered password has a capital letter else messagebux "Cnter a minimum password lerugth of 4
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started