Example #1
0
/**
   Writes an employee record to a stream.
   @param e the employee record to write
   @param out the stream to write to
*/
void write_employee(Employee e, ostream& out)
{  
   out << e.get_name()
      << setw(10 + (30 - e.get_name().length()))
      << fixed << setprecision(2)
      << e.get_salary();
}
Example #2
0
/**
   Constructs a department with a given name and receptionist.
   @param n the department name
   @param e the receptionist
*/
Department::Department(string n, Employee e)
{
   name = n;
   receptionist = new Employee(e.get_name(), e.get_salary());
   
   cout << "Constructor: ";
   print();
}
Example #3
0
/**
   Prints a description of this department.
*/
void Department::print() const
{
   cout << "[name=" << name << ",receptionist=";
   if (receptionist == NULL)
      cout << "NULL";
   else
      cout << receptionist->get_name();
   cout << "]\n";
}
Example #4
0
/**
   Prints a description of this department.
*/
void Department::print() const
{
   cout << "Name: " << name << "\n"
        << "Receptionist: ";
   if (receptionist == NULL)
      cout << "None";
   else
      cout << receptionist->get_name() << " "
           << receptionist->get_salary();
   cout << "\nSecretary: ";
   if (secretary == NULL)
      cout << "None";
   else if (secretary == receptionist)
      cout << "Same";
   else 
      cout << secretary->get_name() << " "
           << secretary->get_salary();      
   cout << "\n";
}