Question: Question2.h is needed. main.cpp cannot be changed. CONTEXT OF THE QUESTION A password for a website consists of three components which are: . letters, number,

Question2.h is needed. main.cpp cannot be changed.

Question2.h is needed. main.cpp cannot be changed. CONTEXT OF THE QUESTION Apassword for a website consists of three components which are: . letters,number, special characters in that exact order. For example, a password could

CONTEXT OF THE QUESTION A password for a website consists of three components which are: . letters, number, special characters in that exact order. For example, a password could be: Password1: COP3503++ These components will be called: prefix, middle, and suffix respectively. In this example this is: prefix = COP middle = 3503 suffix = ++ You are given a binary file that has the following structure: . Number of passwords stored in the file (int) . Number of the characters in the letter part of the password (int) . Letters in the password (Chars) . A number (int) . Number of special characters (int) . Special characters (Chars) TASKS Your task is to: Using the given the structures name password and file: . (1 point) Define the default constructor such as: prefix = "ABC"; middle = 123; suffix = "+"; . (2 points) Define the parametrization for the structure, that takes all three elements as parameters and constructs the password from it. . (3 points) Complete the member function getGeneratedPassword in the password structure that takes in a fstream object and reads into it an object of type password. . (4 points) Complete the member function readAllPasswords in the file structure that reads all the passwords stored in the file. NOTE: . Do not change the already written code. . Some test cases are hidden. . Make sure to submit for grading and check if you have passed the three cases.File is marked as read only Current file: main.cpp 1 #include #include "Question2.h" 3 using namespace std; 4 5 int main ( ) { 7 int tcType; 8 cin >> tcType; 9 if (tcType == 1) { 10 Password defaultPassword; 11 defaultPassword . printPassword( ) ; 12 } else if(tcType = = 2) { 13 Password paramPassowrd ( "johnDoe", 780462143, " *") ; 14 paramPassowrd . printPassword( ) ; 15 16 return 0; 17 }1 #include 2 #include 3 #include 4 using namespace std; 5 struct Password { string prefix; 7 int middle; 8 string suffix; 9 10 Password ( ) { 11 // Implement the default constructor 12 13 14 Password (string prefix, int middle, string suffix) { 15 // Define the parameterized constructor 16 17 18 void printPassword( ) { 19 cout passwords; 30 void readAllPasswords (string filename) { 31 // complete the code to be able to read and store all the passwords in the vector of passwords// 32 33 }; 34

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 Programming Questions!