Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following simple class Employee declaration and its implementation as shown below: // a simple class employee class Employee { public: // constructors Employee()

Consider the following simple class Employee declaration and its implementation as shown below:

// a simple class employee

class Employee { public: // constructors Employee() { _emplID = 0; _fname = _lname = "No Name";} Employee(int emplID, string fname, string lname): _emplID(emplID), _fname(fname), _lname(lname) {}

// get function members int getEmployeeID() const { return _emplID; } string getFirstName() const { return _fname; } string getLastName() const {return _lname; }

// set function members void setEmployeeID(int id); void setFirstName(string fn) { _fname = fn; } void setLastName(string ln) { _lname = ln; }

// display an employee object to standard output void display() const;

// destructor ~Employee() {} private: int _emplID; string _fname, _lname; };

// class Employee member functions implementation void Employee::setEmployeeID(int id) { if (id > 0) _emplID = id; }

void Employee::display() const { cout << "EMPLOYEE: " << _emplID << endl; cout << "Last Name, First Name: " << _lname << ", " << _fname; cout << endl << endl; }

Write a complete and well documented program that implements linear search on a vector of Employee objects. Your program should prompt the user to enter the number of employees and then get the employee data (Employee ID, First Name, and Last Name) for each employee. Subsequently, your program must prompt the user to enter the key (an employee ID) to search for the employee with such ID. If the search is successful in finding an employee ID match, your program should print the first name and last name of the employee. If not found, your program should print a message No employee found.

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 Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago