Question: Hello, I need help with a basic c# program. The program is supposed to check a password validity with certain conditions. I have two of
Hello, I need help with a basic c# program. The program is supposed to check a password validity with certain conditions. I have two of the conditions. I am running into an issue where I am trying to get the program to check for upper case and lower case from the user input. I now I should use Islower and isUpper but I do not have a clear understanding of how. I have been researching for hours. Below is what I have:
using System;
namespace Deliverable1 { class Program { static void Main(string[] args) { string password; const int maxLength = 12; const int minLength = 7; bool hasUpperCase; bool hasLowerCase;
Console.WriteLine("Please enter a password with the following criteria:"); Console.WriteLine("At least one lowercase letter"); Console.WriteLine("At least one uppercase letter"); Console.WriteLine("At least minimum 7 characters"); Console.WriteLine("At least a maximum 12 characters"); Console.WriteLine("Must include one exclamation point(!)");
password = Console.ReadLine(); // gets password from user
//int passwordLength = int.Parse(password);
if (password.Length < minLength || password.Length > maxLength) // checks max and min length of string inputted by user { Console.WriteLine("Password is not valid");
} else if() {
} } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
