C++, This is second time to ask the same question....The last guy was just copy
ID: 3765772 • Letter: C
Question
C++, This is second time to ask the same question....The last guy was just copy the wrong code from other website to fake me up. Please write 3 file including the .h and 2 .cpp. Please post all 3 files' code.
Project 1: Username and Password Validator
Create a C++ class which, when fed a username and password, can validate that the username and password meets the following criteria:
The username should:
- have at least 8 characters long
- contains only alpha numeric characters (no spaces or special characters)
- contain at least 1 uppercase character
- contain at least 1 lowercase character
- contain at least 1 numeric character (0-9)
The password should:
- not contain a user’s username (i.e. the username “CraigKapp1 is valid, but if that user has the password “CraigKapp1Password”, this password would not be valid because it contains the string “CraigKapp1)
- be at least 8 characters long
- only contain alpha numeric characters (no spaces or special characters)
- contain at least 1 uppercase character
- contain at least 1 lowercase character
- contain at least 1 numeric character (0-9)
HINT: For this assignment, a very useful library of helper functions are available when you say: #include <cctype> which is documented for you here.
A number of different program dialogues describe the program I am looking for.
CS52 Username/Password Validator
Username: SmcCorsair1
Password: GoDodgers1
The Username/Password combination is valid!
CS52 Username/Password Validator
Username: SmcCorsair
Password: GoDodgers1
The Username requires numeric character
CS52 Username/Password Validator
Username: smccorsair1
Password: GoDodgers1
The Username requires an uppercase character
CS52 Username/Password Validator
Username: SMCCORSAIR1
Password: GoDodgers1
The Username requires an lowercase character
CS52 Username/Password Validator
Username: corsair
Password: GoDodgers1
The Username requires atleast 8 letters
CS52 Username/Password Validator
Username: SmcCorsair1
Password: aaSmcCorsair1aa
The Password cannot contain the Username
CS52 Username/Password Validator
Username: SmcCorsair1
Password: gododgers1
The Password requires an uppercase character
CS52 Username/Password Validator
Username: SmcCorsair1
Password: GODODGERS1
The Password requires an lowercase character
CS52 Username/Password Validator
Username: SmcCorsair1
Password: Smc1
The Password requires atleast 8 letters
Following the diagrams show below, create the class UsernamePasswordValidator.
UsernamePasswordValidator( );
void setUsername( string username );
void setPassword( string password );
void setUsernameViaCString( char * username );
void setPasswordViaCString( char * password );
void reset( );
bool isValid( );
string reasonForFailure( );
string myUsername;
string myPassword;
bool my_ValidationFailed;
string my_ReasonWhyItFailed;
UsernamePasswordValidator upv;
string user, pass;
char * badpassword = "data ";
char * goodpassword = "goodPassword1";
cout << "CS52 Username/Password Validator" << endl;
cout << "Username:" << endl;
getline( cin, user ); // reads a whole line of input
cout << "Password:" << endl;
getline( cin, pass ); // reads a whole line of input
upv.setUsername( user );
upv.setPassword( pass );
if (upv.isValid() )
{
cout << "The Username/Password combination is valid!" << endl;
}
else
{
cout << upv.reasonForFailure( ) << endl;
}
upv.reset( );
upv.setUsername( user );
upv.setPassword( badpassword );
if (upv.isValid() )
{
cout << "The Username/Password combination is valid!" << endl;
}
else
{
cout << upv.reasonForFailure( ) << endl;
}
UsernamePasswordValidator( );
void setUsername( string username );
void setPassword( string password );
void setUsernameViaCString( char * username );
void setPasswordViaCString( char * password );
void reset( );
bool isValid( );
string reasonForFailure( );
string myUsername;
string myPassword;
bool my_ValidationFailed;
string my_ReasonWhyItFailed;
UsernamePasswordValidator upv;
string user, pass;
char * badpassword = "data ";
char * goodpassword = "goodPassword1";
cout << "CS52 Username/Password Validator" << endl;
cout << "Username:" << endl;
getline( cin, user ); // reads a whole line of input
cout << "Password:" << endl;
getline( cin, pass ); // reads a whole line of input
upv.setUsername( user );
upv.setPassword( pass );
if (upv.isValid() )
{
cout << "The Username/Password combination is valid!" << endl;
}
else
{
cout << upv.reasonForFailure( ) << endl;
}
upv.reset( );
upv.setUsername( user );
upv.setPassword( badpassword );
if (upv.isValid() )
{
cout << "The Username/Password combination is valid!" << endl;
}
else
{
cout << upv.reasonForFailure( ) << endl;
}
Explanation / Answer
Program:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.