Please write a C++ program to check a password to see whether it is really secure. This program is like a password game. If the password is not secure, your program must report all its security violations. Please see the following test case #1 to design your application program. You must stop your program when the password from the user is "quit". In other words, “quit" cannot be a password in this game. You must write 7 functions to check the following 7 security rules for any given password. Rule 1: Length invalid – The length of the password must be 8 to 12 only. Rule 2: No Space – The password must not contain any space or blank character. Rule 3: At least 2 digits – The password must contain at least 2 digits. Rule 4: At least 1 upper-case letter – The password must contain at least one upper-case letter. Rule 5: At least 1 lower-case letter – The password must contain at least one lower-case letter. Rule 6: At least 1 special character – The password must contain at least one special character, which can be one of the following 7 choices: 'S', #', '@, '&', *', '?’, or '!'. Rule 7: No special numbers – The password must not contain any of the following 4 numbers: 2020, 2019, 2018, or 2017. Your test case #1 must look exactly as follows including the data. You must also do test case #2 and test case #3 with different sets of input data. Each test case must test at least 5 passwords with 2 secure and 3 non-secure. All those 7 violations must appear in those 3 non-secure passwords. Each test case or test run must begin with a welcome message, and must end with a thank-you message.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

#include <string> // for string processing
#include <iostream> // Access input output stream: cin cout
using namespace std; // Access cout, endl, cin without using std:: as prefix
// 8 global variables and 7 prototypes of functions

string pw; // global pw for the password to be checked
bool r1, r2, r3, r4, r5, r6, r7; // global 7 boolean flags for violations
void s1(); void s2(); void s3(); void s4(); void s5();
void s6(); void s7(); // 7 prototypes of functions to be defined after main()
int main() // like a driver to call those 7 functions to check a password
{// begin of main // must return integer to the caller
cout << "Welcome to the PASSWORD game designed by Joel!" << endl;
cout << "Please enter a password:" << endl;
getline(cin, pw); // pw may have blanks anywhere, so must use getline( )
cout << "Your password \"" << pw << "\" " ;

while (pw != "quit") // the password is not “quit”
{ //begin of while loop

s1(); s2(); s3(); s4();
s5(); s6(); s7(); // call to check all 7 rules for satisfaction/violation

if (r1 && r2 && r3 && r4 && r5 && r6 && r7) // all 7 rules satisfied
cout << "is very secure! Congratulations!" << endl ;
else // insecure password

{ // begin print all the violated rules in detail ================.
cout << "violates the following rule(s):" << endl ; // You must complete all the following strings
if (!r1) cout << "Rule 1: Length invalid – The length of the password must ---
if (!r2) cout << "Rule 2: No Space – The password must not contain any space ---
if (!r3) cout << "Rule 3: At least 2 digits – The password must ---
if (!r4) cout << "Rule 4: At least 1 upper-case letter – The password must ---
if (!r5) cout << "Rule 5: At least 1 lower-case letter – The password must ---
if (!r6) cout << "Rule 6: At least 1 special character – The password must --
if (!r7) cout << "Rule 7: No special numbers – The password must not contain ---
} // end print all the violated rules in detail =====================.
cout << "Please enter a password:" << endl;
getline(cin, pw); // pw may have blanks anywhere, so must use getline( )
cout << "Your password \"" << pw << "\" ";
} // end of while loop ==============================================.

cout << "is to quit the game." << endl;
cout << "Thank you for playing the PASSWORD game designed by Joel!";
return 0 ; // return integer 0 to show the job is well done now.
} // end of main =========================================================.

PJ 9 – Password Game
Please write a C++ program to check a password to see whether it is really secure. This program is like a
password game. If the password is not secure, your program must report all its security violations. Please
see the following test case #1 to design your application program. You must stop your program when the
password from the user is “quiť". In other words, “quit’ cannot be a password in this game.
You must write 7 functions to check the following 7 security rules for any given password.
Rule 1: Length invalid – The length of the password must be 8 to 12 only.
Rule 2: No Space – The password must not contain any space or blank character.
Rule 3: At least 2 digits – The password must contain at least 2 digits.
Rule 4: At least 1 upper-case letter – The password must contain at least one upper-case letter.
Rule 5: At least 1 lower-case letter – The password must contain at least one lower-case letter.
Rule 6: At least 1 special character – The password must contain at least one special character, which
can be one of the following 7 choices: S', #', '@°, '&', *', '?’, or !.
Rule 7: No special numbers – The password must not contain any of the following 4 numbers:
2020, 2019, 2018, or 2017.
Your test case #1 must look exactly as follows including the data. You must also do test case #2 and test
case #3 with different sets of input data. Each test case must test at least 5 passwords with 2 secure and 3
non-secure. All those 7 violations must appear in those 3 non-secure passwords. Each test case or test run
must begin with a welcome message, and must end with a thank-you message.
Transcribed Image Text:PJ 9 – Password Game Please write a C++ program to check a password to see whether it is really secure. This program is like a password game. If the password is not secure, your program must report all its security violations. Please see the following test case #1 to design your application program. You must stop your program when the password from the user is “quiť". In other words, “quit’ cannot be a password in this game. You must write 7 functions to check the following 7 security rules for any given password. Rule 1: Length invalid – The length of the password must be 8 to 12 only. Rule 2: No Space – The password must not contain any space or blank character. Rule 3: At least 2 digits – The password must contain at least 2 digits. Rule 4: At least 1 upper-case letter – The password must contain at least one upper-case letter. Rule 5: At least 1 lower-case letter – The password must contain at least one lower-case letter. Rule 6: At least 1 special character – The password must contain at least one special character, which can be one of the following 7 choices: S', #', '@°, '&', *', '?’, or !. Rule 7: No special numbers – The password must not contain any of the following 4 numbers: 2020, 2019, 2018, or 2017. Your test case #1 must look exactly as follows including the data. You must also do test case #2 and test case #3 with different sets of input data. Each test case must test at least 5 passwords with 2 secure and 3 non-secure. All those 7 violations must appear in those 3 non-secure passwords. Each test case or test run must begin with a welcome message, and must end with a thank-you message.
Welcome to the PASSWORD game designed by Dr. Simon Lin! Emust use your name
1==
Please enter a password:
The password" violates the following rules):
Rule 1: Length invalid - The length of the password must be 8 to 12 only.
Rule 2: No Space- The password must not contain any space or blark character.
Rule 3: At least 2 digits - The password must contain at least 2 digits.
Rule 4: At least 1 upper-case letter - The password must contain at least one upper-case letter.
Rule 5: At least 1 lower-case letter - The password must contain at least one lower-case letter.
Rule 6: At least 1 special character- The password must contain at least one special character, which can be
one of the following 7 choices: "S', =, @, &,
€just one space here
, or !".
2==
Please enter a password: 007
The password "0 0 7" violates the following rule(s):
Rule 1: Length invalid - The length of the password must be 8 to 12 only.
Rule 2: No Space - The password must not contain any space or blank character.
Rule 4: At least 1 upper-case letter -The password must contain at least one upper-case letter.
Rule 5: At least 1 lower-case letter - The password must contain at least one lower-case letter.
Rule 6: At least l special character- The password must contain at least one special character, which can be
one of the following 7 choices: "S", =,@, &,*,7", or T.
Please enter a password: $007SLin!
Your password "S007SLin!" is very secure! Congratulations!
Page l of 5
csi16 Programming in C++
Project 9 (RI9)
Dr. Lin vernien 42121
Please enter a password: #1SimonLin
The password =1SimonLin" violates the following rule(s):
Rule 3: At least 2 digits - The password must contain at least 2 digits.
Please enter a password: SLin2019@
The password "SLin2019@" violates the following rule(s):
Rule 7: No special numbers - The password must not contain any of the following 4 mumbers: 2020, 2019,
2018, or 2017.
6====
Please enter a password: $2021LimWins
Your password "S2021LinWins" is very secure! Congratulations!
Please enter a password: quit
Your password "quit" is to quit the game.
8===
Thank you for playing the PASSWORD game designed by Dr. Simon Lin!
must use your name
Transcribed Image Text:Welcome to the PASSWORD game designed by Dr. Simon Lin! Emust use your name 1== Please enter a password: The password" violates the following rules): Rule 1: Length invalid - The length of the password must be 8 to 12 only. Rule 2: No Space- The password must not contain any space or blark character. Rule 3: At least 2 digits - The password must contain at least 2 digits. Rule 4: At least 1 upper-case letter - The password must contain at least one upper-case letter. Rule 5: At least 1 lower-case letter - The password must contain at least one lower-case letter. Rule 6: At least 1 special character- The password must contain at least one special character, which can be one of the following 7 choices: "S', =, @, &, €just one space here , or !". 2== Please enter a password: 007 The password "0 0 7" violates the following rule(s): Rule 1: Length invalid - The length of the password must be 8 to 12 only. Rule 2: No Space - The password must not contain any space or blank character. Rule 4: At least 1 upper-case letter -The password must contain at least one upper-case letter. Rule 5: At least 1 lower-case letter - The password must contain at least one lower-case letter. Rule 6: At least l special character- The password must contain at least one special character, which can be one of the following 7 choices: "S", =,@, &,*,7", or T. Please enter a password: $007SLin! Your password "S007SLin!" is very secure! Congratulations! Page l of 5 csi16 Programming in C++ Project 9 (RI9) Dr. Lin vernien 42121 Please enter a password: #1SimonLin The password =1SimonLin" violates the following rule(s): Rule 3: At least 2 digits - The password must contain at least 2 digits. Please enter a password: SLin2019@ The password "SLin2019@" violates the following rule(s): Rule 7: No special numbers - The password must not contain any of the following 4 mumbers: 2020, 2019, 2018, or 2017. 6==== Please enter a password: $2021LimWins Your password "S2021LinWins" is very secure! Congratulations! Please enter a password: quit Your password "quit" is to quit the game. 8=== Thank you for playing the PASSWORD game designed by Dr. Simon Lin! must use your name
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY