- Write a program named “password” that validates passwords. The user will enter a password. Then the program will use a function to check whether it is valid. The requirements are as follows:
The password must be 7 characters long
It must contain at least one uppercase letter
It must contain at least one lowercase letter
It must contain at least one numeric digit
Use the following algorithm for the validate function (boolean) to help you:
-
Set the correct length variable to false
-
Set the has uppercase variable to false
-
Set the has lowercase variable to false
-
Set the has digit variable to false
-
If password length is 7 character
Set the correct length variable to true For each character entered If the character is an uppercase letter Set the has uppercase variable to true If the character is a lowercase letter Set the has lowercase variable to true If the character is a digit Set the has digit variable to true -
If all the above variables are true
Set the is valid variable to true
Else
Set the is valid variable to false
