Please send questions to st10@humboldt.edu .
/*-------------------------------------------------------
 Implementation file for class Prof

 created by: Sharon Tuttle
 last modified: 11-01-03 (adding member functions
                         alphaName, mailingName)
                12-11-03 (adding no-argument constructor
                         and making comments prettier
                         and adding overloaded ==)
---------------------------------------------------------*/

#include <cmath>
#include "Prof.h"
using namespace std;

//-----
// implementation of constructors
//----- 

Prof::Prof(string lname, string fname, string mname,
           string ttl, string email, string offcHrs, 
           double sal)
{
    lastName = lname;
    firstName = fname;
    middleName = mname;
    title = ttl;
    emailAddress = email;
    officeHrs = offcHrs;
    salary = sal;
}

Prof::Prof(): lastName(""), firstName(""), middleName(""), title(""),
        emailAddress(""), officeHrs(""), salary(0)
{
    // deliberately empty
}

//-----
// implementation of accessor functions
//-----

string Prof::get_lastName() const
{
    return lastName;
}

string Prof::get_firstName() const
{
    return firstName;
}

string Prof::get_middleName() const
{
    return middleName;
}

string Prof::get_title() const
{
    return title;
}

string Prof::get_emailAddress() const
{
    return emailAddress;
}

string Prof::get_officeHrs() const
{
    return officeHrs;
}

double Prof::get_salary() const
{
    return salary;
}

//-----
// implementation of mutator functions
//-----
        
void Prof::set_lastName(string new_lname)
{
    lastName = new_lname;
}
          
void Prof::set_firstName(string new_fname)
{
    firstName = new_fname;
}       

void Prof::set_middleName(string new_mname)
{
    middleName = new_mname;
}       

void Prof::set_title(string new_ttl)
{
    title = new_ttl;
}       
        
void Prof::set_emailAddress(string new_email)
{
    emailAddress = new_email;
}       
        
void Prof::set_officeHrs(string new_offHrs)
{
    officeHrs = new_offHrs;
}       
        
void Prof::set_salary(double new_sal)
{
    salary = new_sal;
}       

//-----
// implementation of overloaded operators
bool Prof::operator == (const Prof& rhProf) const
{
    return ((lastName == rhProf.lastName)
            && (firstName == rhProf.firstName)
            && (middleName == rhProf.middleName)
            && (title == rhProf.title)
            && (emailAddress == rhProf.emailAddress)
            && (abs(salary - rhProf.salary) < .00001));
}

//-----
// implementations of other member functions
//-----

/*--------------------------------------------------
 Contract: alphaName : void -> string
 Purpose: Return a single string of the form:
          lastName, firstName middleName
          ... of the object for which this function
          is called.

 Examples: cs131_prof.alphaName() ==
           "Tuttle, Sharon Marie"
--------------------------------------------------*/

string Prof::alphaName() const
{
    return lastName + ", " + firstName + " " +
  	   middleName;
}
 
/*--------------------------------------------------
 Contract: mailingName : void -> string
 Purpose: Return a single string of the form:
          title firstName middleName lastName
          ... of the object for which this
          function is called.

 Examples: cs131_prof.mailingForm() ==
           "Dr. Sharon Marie Tuttle"
--------------------------------------------------*/
string Prof::mailingName() const
{
    return title + " " + firstName + " " + middleName
	   + " " + lastName;
}