Problem: In the code below, Employee class stores employee name, age and password. But there are…

Problem: In the code below, Employee class stores employee name, age and password. But there are some
conditions for employee class object that are
1. Employee age must be greater than 18
2. Password must have followed following rules
• Password must contain at least one lower case alphabet
• Password must contain at least one upper case alphabet
• Password must contain at least 1 number
• Password must contain at least one special character.
While class EmployeeList is used to store new employee objects. It’s AddEmployee function create new objects of
employee class and store them in the list. If during creation of employee objects input data is not according to
conditions, you must through an exception. For this purpose,
1. create two classes ageException and passwordException. Each have a data member msg of string type and a
parameterized constructor to initialize msg.
2. Throw these classes objects with proper msgs as exceptions from check age and check password functions.
3. Add employee function will use try and catch blocks to capture these exceptions. Function must display the
exception msg to the user.
a. Incase exception thrown is ageException then delete the dynamically created object of employee
and display msg that this employee can’t be added.
b. Incase exception thrown is passwordException then after displaying the exception msg. Prompt user
if he wants to enter password again or to cancel the addition. If he wants to enter again ask him
check the condition and repeat cycle and if he wants to cancel it, then delete the dynamically
created object of employee and display msg that this employee addition failed.

Also implement the class in main function after adding above conditions into the below class

class Employee {
string firstName;
string lastName;
int age;
string password;
Employee(string fn, string ln, int a, string p) :firstName(fn), lastName(ln)
age = a;
password = p;
cout << “Employee Pbject Created”;
~Employee() { cout << “destructor called”; }
string getFirstName() { return firstName; }
string getLastName() { return lastName; }
int getAge() { return age; }
void checkAge(int a) {

void checkPassword(string input) {
int n = input.length();
bool hasLower = false, hasUpper = false;
bool hasDigit = false, specialChar = false;
string normalChars = “abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 “;
for (int i = 0; i < n; i++) {
if (islower(input[i]))
hasLower = true;
if (isupper(input[i]))
hasUpper = true;
if (isdigit(input[i]))
hasDigit = true;
size_t special = input.find_first_not_of(normalChars);
if (special != string::npos)
specialChar = true;
class EmployeeList {
Employee** list;
int capacity;
int count;
EmployeeList(int size) {
capacity = size;
list = new Employee * [size];
count = 0;
void addEmployee(string fn, string ln, int a, string p)
list[count] = new Employee(fn, ln, a, p);

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!