Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. pwdg_oo.cpp (20 points with no partial credits) This program defines a class called Pwdg (i.e., password generator). You may include in this class as

1. pwdg_oo.cpp (20 points with no partial credits)

This program defines a class called Pwdg(i.e., password generator). You may include in this class as many data members as needed but they must be all private. For grading purpose, you must implement a zero-parameter public member function called getPWD() in this class to return a password of string type. The length of the password is given when a Pwdg object is created in main().

Every password generated by getPWD() must consist of randomly selected characters from ten digits of 0 ~ 9, 52 letters of a ~ z and A ~ Z, plus 11 symbols of { ! @ # $ % ^ & * + - = }, not including the curly braces. All passwords must be truly randomly generated, meaning there should be no fixed patterns or predictable trends that can be traced if the program is executed repeatedly. Hint: research rand()and srand(). Do not use Random class because it is a .NET class, not supported by standard C++.

The main()function performs the following three tasks:

Prompts "Enter length of password: " to get the length from user.

Make a Pwdg object with the length specified above and call getPWD() of the object to get a password.

Displays the password in the form "Password: ............."

The figure below shows a sample screenshot of executing pwdg_oo.cpp:

2. pwdg_oo_i.cpp (20 points with no partial credits)

In addition to the same Pwdg class defined in pwdg_oo.cpp, this program defines a second class called Simple_pwdg, which inherits Pwdg class. As a derived class, it defines and implements an additional member function called getSimplePWD(char x), where 'x' could have a value of 'D' or 'L'. If 'D', this function will generate and return a password with specified length of randomly selected digits only. If 'L', then the password generated and returned contains randomly selected letters only.

The main() function performs the following tasks:

Prompts "Enter length of password: " to get the length from user.

Prompts "Want a password containing digits only? (Y/N) "

If user enter 'Y', an object of Simple_pwdgis created with the specified length and its getSimplePWD(char x) function is called to return and display an all-digit password in the form "Password: .............".

If user enter 'N', then prompts "Want a password containing letters only? (Y/N) "

If user enter 'Y', an object of Simple_pwdgis created with the specified length and its getSimplePWD(char x) function is called to return and display an all-letter password in the form "Password: .............".

If user enter 'N', then an object of Pwdgis created with the specified length and its getPWD() function is called to return and display a password in the form "Password: .............".

The figure below shows a sample screenshot of three executions of pwdg_oo_i.cpp:

3. pwdg_oo_i_s.cpp (20 points with no partial credits)

In addition to the same Pwdg class defined in pwdg_oo.cpp, this program defines a second class called Strong_pwdg, which inherits Pwdg class. As a derived class, it defines and implements an additional member function called getStrongPWD(), which has no parameters. This function returns a strong password that satisfies the following conditions.

(i) Minimal length of the password is 8 characters. So, if user specifies a number less than eight, the function will force it to be changed to eight.

(ii) A strong password is guaranteed to contain four mandatory characters, including one digit, one symbols (as defined in pwdg_oo.cpp), one upper-case letter, and one lower-case letter.

(iii) The above four mandatory characters are randomlylocated in the password. That is, there is no fixed formula regarding where each of these mandatory characters are placed.

Particularly for grading purpose, getStrongPWD() would display the four mandatory characters in the form shown below. For example, if the mandatory characters are 3 % H t, they are displayed as

"Four mandatory random chars: 3 % H t"

The main() function of this program performs the following tasks:

Prompts "Enter length of password: " to get the length from user.

Prompts "Want a strong password? (Y/N) "

If user enter 'Y', an object of Strong_pwdgis created with the specified length and its getStrongPWD() function is called to return and display a strong password in the form " Password: .............". **Note: the four mandatory characters should be displayed first by getStrongPWD() before the password is generated and displayed.

If user enter 'N', then an object of Pwdg is created with the specified length and its getPWD() function is called to return and display a password in the form "Password: .............".

The figure below shows a sample screenshot of executing pwdg_oo_i_s.cpp:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions