Question: ( static void Main ( string [ ] args ) { string sTitle = Mason Solano ICA 9 ; string sPassword =
static void Mainstring args
string sTitle "Mason Solano ICA;
string sPassword ;
do
Console.Clear;
Console.CursorLeft ConsoleWindowWidth sTitle.Length; display the title in the middle
Console.WriteLinesTitle;
bool bValidPassword true;
bool bLowercase false;
bool bUppercase false;
bool bSymbol false;
int iDigitcount ;
int iFirstdigit ;
bool bDifferentDigits false;
bool bSpace false;
do
Console.WriteLine
Please enter a password to check: ;
sPassword Console.ReadLine;
if sPasswordLength
Console.WriteLinePassword must be characters long.";
bValidPassword false;
foreach char cCharacter in sPassword
if charIsUppercCharacter
bUppercase true;
else if charIsLowercCharacter
bLowercase true;
else if char.IsSymbolcCharacter
bSymbol true;
else if charIsDigitcCharacter
int iDigit intcharGetNumericValuecCharacter; Convert character to its digit value
if iDigitcount
iFirstdigit iDigit; Store the first digit found
else if iDigit iFirstdigit
bDifferentDigits true; Check if the digit is different from the first
iDigitcount; Increment digit counter
if charIsWhiteSpacecCharacter
bSpace true;
Console.WritePassowrd cannot contain a space.";
bValidPassword false;
if bUppercase
Console.WriteLinePassword doesn't contain an Uppercase.";
bValidPassword false;
if bLowercase
Console.WriteLinePassword must conatain a Lowercase.";
bValidPassword false;
if bSymbol
Console.WriteLinePassword must contain a symbol.";
bValidPassword false;
if iDigitcount
Console.WriteLinePassword must conatin atleast digits.";
bValidPassword false;
else if bDifferentDigits
Console.WriteLinePassword must be different digits.";
bValidPassword true;
if bSpace
Console.WriteLinePassword must not caontain spaces.";
bValidPassword false;
if bValidPassword
Console.WriteLinePassword is valid.";
bValidPassword true;
else
Console.WriteLinePassword is invalid.";
bValidPassword false;
while bValidPassword;
Console.WriteDo you want to run this program again yn: ;
while charToLowerConsoleReadKeyKeyChary;
Fix this code so it gives me a valid password to end loop and invalid password
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
