Question: This program will be creating a vector with logins made up of user names and passwords. I suggest writing this project in two parts to

This program will be creating a vector with logins made up of user names and passwords. I suggest writing this project in two parts to eliminate the frustration of trying to code/test too much code at one time. Part I Creating a vector composed of user names. Write a C++ program that allows the user to input these string values: 1- Users first name into firstName. 2- Users last name into lastName. The program places the first letter of the first name plus the first 5 characters of the last name into the string login. You can assume the last name is at least 5 characters. The combined strings (login) will then be stored in a string vector. See Display 8.4 for sample code concatenating strings, and Display 8.7 for a list of string functions. Repeat the process of entering user names until the user enters 0 for firstName. Output the list to the screen by displaying the vector items (the logins) one per line after building the vector. See lines 18-20 in 08.09.cpp. Page 2 of 4 Part II now add a password to the login after checking the password for errors. Before adding the password to the login string, write a class named Validate (Validate.h) to validate the entry. The class should have the following functions: o displayMsg Displays the messages in the message array so the user knows the rules for creating the password. o checkLength Length of the string is at least 6 characters. Error message =: Password must be 6 characters. Returns true if the length is incorrect and false if the length is correct. o checkSpaces Cannot contain a space. Error message =: Password cannot contain a space. Returns true if there are spaces and false if there are no spaces. o checkUpper One character must be an upper case letter. Error message =: One letter must be upper case. Returns true if there are no upper case letters and false if there is an upper case letter. The Validate class should contain: Constructor that receives a string Default constructor These functions: displayMsg checkLength checkSpaces checkUpper These variables/constants: String entry; const int LEN = 6; //use this constant in checkLength. String array containing error messages. Use this array to display any messages required in the functions. Page 3 of 4 Here is the pseudocode for using the Validate class: In the while loop in main, add a do loop that Displays the error messages. requests a password. instantiates an object using the constructor in Validate call the functions to validate the password. repeat the loop if true is returned from any of the 3 called functions Display any and all error messages. After the password is validated, add a do loop to request the password a second time. This loop should verify that the first password entered is the same as the second entry. If not, display an error message and request the password again. After the two passwords match, add the password string to the login before storing it in the vector. login takes the form username, password For example: pmadis, Abc123 Note the addition of the comma and space between the username and password. Page 4 of 4 Purpose of this project Develop C++ program with the following features: o Strings Use the string class. o Vectors Check the example in Display 8.9. o Character functions Check Display 6.9.

//DISPLAY 8.9 Using a Vector #include #include using namespace std;

int main( ) { vector v; cout << "Enter a list of positive numbers. " << "Place a negative number at the end. ";

int next; cin >> next; while (next > 0) { v.push_back(next); cout << next << " added. "; cout << "v.size( ) = " << v.size( ) << endl; cin >> next; }

cout << "You entered: "; for (unsigned int i = 0; i < v.size( ); i++) cout << v[i] << " "; cout << endl;

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!