Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This is the code I have so far, just need help with the areas that say "***".


#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 =========================================================.

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
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.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education