Please let me know if you have any doubts or you want me to modify
the answer. And if you find this answer useful then don't forget to
rate my answer as thumps up. Thank you! :)
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
void prompt_input();
void get_input(string& userPassword);
void validate_Password(string userPassword, bool& correct_Password);
bool user_Validate(string userPassword, string& userPassword2);
void attempts_reached();
int main()
{
string userPassword;
string userPassword2;
bool correct_Password = false;
int attempts = 3;
prompt_input();
while (attempts > 0 &&
correct_Password == false)
{
if (attempts > 0
&& correct_Password == false)
{
get_input(userPassword);
validate_Password(userPassword, correct_Password);
attempts--;
}
if (attempts == 0
&& correct_Password == false)
{
attempts_reached();
}
if (correct_Password
== true)
{
user_Validate(userPassword, userPassword2);
}
}
return 0;
}
void prompt_input()
{
cout << endl << setw(45) <<
"-------------------------------------------" << endl;
cout << setw(33) << "Enter a
password that contains:" << endl;
cout << setw(45) << "At least eight
(8) characters, one number, " << endl;
cout << setw(50) << "one upper case
letter, and one lower case letter" << endl;
}
void get_input(string& userPassword)
{
cout << endl << setw(12) <<
"Password: ";
cin >> userPassword;
cout << endl;
}
void validate_Password(string userPassword, bool&
correct_Password)
{
int index;
int uppercase = 0;
int lowercase = 0;
int digit = 0;
for (index = 0; index <
userPassword.length(); index++)
{
if
(isupper(userPassword[index]))
uppercase++;
if
(islower(userPassword[index]))
lowercase++;
if
(isdigit(userPassword[index]))
digit++;
}
if (userPassword.length() < 8 || uppercase
== 0 || lowercase == 0 || digit == 0)
{
cout <<
" " << userPassword;
cout << " is not a
valid password." << endl;
}
if (userPassword.length() < 8)
{
cout << setw(48)
<< "It must be at least eight characters long." <<
endl;
}
if (uppercase == 0)
{
cout << setw(47)
<< "It does not contain an upper case letter." <<
endl;
}
if (lowercase == 0)
{
cout << setw(46)
<< "It does not contain a lower case letter." <<
endl;
}
if (digit == 0)
{
cout << setw(34)
<< "It does not contain a digit." << endl;
}
if (userPassword.length() >= 8 &&
uppercase > 0 && lowercase > 0 && digit >
0)
{
cout << setw(10)
<< userPassword;
cout << " is a
valid password." << endl;
cout << endl
<< setw(38) << "Re-enter the password for validation"
<< endl;
correct_Password =
true;
}
}
void attempts_reached()
{
cout << endl <<setw(73) <<
">>>> That was the third attempt. This
session has been locked. <<<<" <<
endl << endl;
}
bool user_Validate(string userPassword, string&
userPassword2)
{
bool match = false;
cout << endl << setw(12) <<
"Re-Entry: ";
cin >> userPassword2;
cout << endl;
if (userPassword == userPassword2)
{
cout << setw(46)
<< "**** The password has been approved. *****" <<
endl;
match = true;
}
if (userPassword != userPassword2)
{
cout << setw(23)
<< "<<< This password '" <<
userPassword2 << "' does not match '" << userPassword
<< "' >>>" << endl;
}
return match;
}
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
please help me out and input values please .. main cpp.. please follow intructions exactly witj...
Write Java program: • Is at least 8 characters long • Contains at least 1 lower letter character • Contains at least 1 upper letter character • Contains at least 1 numeric digit • Contains at least 1 special character from the set: !@#$%^&* • Does not contain the word “and” or the word “the” Prompts the user for a password, including the requirements above in your output. Output a string that states valid or invalid. If invalid, state which...
Can I please get some assistance on this?
1. Write a program to test the correctness of a password according to some rules. If the password is not valid, print messages showing what's wrong with the password. Partial program output should look like this: Please enter a password. It must be at least 8 characters long and contain at least 2 alpha characters, at least one upper case and one lower case, at least 1 numbers, and at least 1...
Design and implement a Java program (name it PasswordTest) that accepts a string from the user and evaluates it as a password, giving it a valid or invalid verdict A good password will be at least 8 characters and includes at least one lower-case letter, at least one upper-case letter, at least one digit, and at least one character that is neither a letter nor a digit. Your program will need to check each character in the string in order...
1. You are given a C file which contains a partially completed
program. Follow the instructions contained in comments and complete
the required functions. You will be rewriting four functions from
HW03 (initializeStrings, printStrings, encryptStrings,
decryptStrings) using only pointer operations instead of using
array operations. In addition to this, you will be writing two new
functions (printReversedString, isValidPassword). You should not be
using any array operations in any of functions for this assignment.
You may use only the strlen() function...
please use c++
please write down the input file information
please add comments for some codes
please do not use #include <bits/stdc++.h> we did not
learn it yet
thank you
CSIT 575-Take Home Lab #11: Arrays To learn to code, compile and run a program processing characters. Assignment Plan and code a top-down modular program utilizing ARRAYS to solve the following problem, using at least 3 functions (called from the main() section or from another function) to solve the problem....
****C PROGRAMMING**** (100 points) Write a program that prompts the user to enter the name of a file. The program encoded sentences in the file and writes the encoded sentences to the output file. Enter the file name: messages.txt Output: encoded words are written to file: messages.txt.swt The program reads the content of the file and encodes a sentence by switching every alphabetical letter (lower case or upper case) with alphabetical position i, with the letter with alphabetical position 25...
Programming Problem 1 - File Name: pass.cpp (5 pts.)
Description:
You were hired by the KFU cybersecurity team to create a program
that checks if the passwords chosen by users are strong or not. A
password is considered strong if the following conditions are
satisfied:
• Its length is at least 8 characters
• It contains at least one uppercase letter.
Input Format:
The program will prompt the user to enter their chosen
password.
Example Input
Enter your...
Please make this Python code execute properly. User needs to create a password with at least one digit, one uppercase, one lowercase, one symbol (see code), and the password has to be atleast 8 characters long. try1me is the example I used, but I couldn't get the program to execute properly. PLEASE INDENT PROPERLY. def policy(password): digit = 0 upper = 0 lower = 0 symbol = 0 length = 0 for i in range(0, len(password)): if password[i].isdigit(): # checks...
FOR JAVA: Summary: Write a program to assess password stringency. The solution should be named Password.java. Include these steps: Write an application that provides the criteria for a strong password, and accepts a user's password from an input dialog box. If the entered password is less than six characters, more than 10 characters, or does not contain at least one uppercase letter and one digit, prompt the user to enter again. When the user's entry meets all the password requirements,...