Link to project:
https://www.codecademy.com/courses/learn-c-sharp/projects/csharp-password-checker
.
Code:
using System;
namespace PasswordChecker
{
class Program
{
public static void Main(string[] args)
{
int min_length = 8;
string uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string lowercase = uppercase.ToLower();
string digits = "123456789";
string special_chars = "`~!@#$%^&*()_{}[]|\'\"<>?/-+=;:\\.,";
Console.Write("Enter a password: ");
string password = Console.ReadLine();
int score = 0;
if (password.Length >= min_length)
{
score++;
}
if (Tools.Contains(password, uppercase))
{
score++;
}
if (Tools.Contains(password, lowercase))
{
score++;
}
if (Tools.Contains(password, digits))
{
score++;
}
if (Tools.Contains(password, special_chars))
{
score++;
}
if ((password == "password") || (password == "1234"))
{
score = 0;
}
switch (score)
{
case 4 || 5:
Console.WriteLine("Your password is extremely strong in security.");
break;
case 3:
Console.WriteLine("Your password is strong in security.");
break;
case 2:
Console.WriteLine("Your password is medium in security.");
break;
case 1:
Console.WriteLine("Your password is weak in security.");
break;
default:
Console.WriteLine("Your password doesn't meet any of the standards.");
break;
}
}
}
}
.
How do I fix the error?