Hashing

profileJjwatzs
Employee.cpp

/** * @author Jane Programmer * @cwid 123 45 678 * @class COSC 2336, Spring 2019 * @ide Visual Studio Community 2017 * @date April 8, 2019 * @assg Assignment 13 * * @description Simple example of an Employee record/class * we can use to demonstrate HashDictionary key/value pair * management. */ #include <string> #include <iostream> #include <iomanip> #include <sstream> #include "Employee.hpp" using namespace std; /** constructor * Default constructor for our Employee record/class. Construct an * empty employee record */ Employee::Employee() { this->id = EMPTY_EMPLOYEE_ID; this->name = ""; this->address = ""; this->salary = 0.0; } /** constructor * Basic constructor for our Employee record/class. */ Employee::Employee(int id, string name, string address, float salary) { this->id = id; this->name = name; this->address = address; this->salary = salary; } /** id accessor * Accessor method to get the employee id. * * @returns int Returns the integer employee id value. */ int Employee::getId() const { return id; } /** name accessor * Accessor method to get the employee name. * * @returns string Returns the string containing the full * employee name for this record. */ string Employee::getName() const { return name; } /** overload operator<< * Friend function to ouput representation of Employee to an * output stream. * * @param out A reference to an output stream to which we should * send the representation of an employee record for display. * @param employee The reference to the employee record to be displayed. * * @returns ostream& Returns a reference to the original output * stream, but now the employee information should have been * inserted into the stream for display. */ ostream& operator<<(ostream& out, Employee& employee) { //out << "Employee id: " << employee.id << endl // << " name : " << employee.name << endl // << " address: " << employee.address << endl // << " salary : " << fixed << setprecision(2) << employee.salary << endl; out << "( id: " << employee.id << ", " << employee.name << ", " << employee.address << ", " << fixed << setprecision(2) << employee.salary << " )" << endl; return out; }