#include <iostream.h>
#include <string.h>
#include <stdio.h>
#include "bool.h"
#include "person.h"


void person::setName(char * newName) {
   strcpy(name, newName);
}


void person::getName(char * nameBuffer) const {
   strcpy(nameBuffer, name);
}


void academic::setDept(char * newDept) {
   strcpy(dept, newDept);
}


void academic::getDept(char * deptBuffer) const {
   strcpy(deptBuffer, dept);
}


void industry::setCompany(char * newCompany) {
   strcpy(company, newCompany);
}


void industry::getCompany(char * companyBuffer) const {
   strcpy(companyBuffer, company);
}


void employee::setSalary(int newSalary) {
   salary = newSalary;
}


void employee::getSalary(int& salaryBuffer) const {
   salaryBuffer = salary;
}


student::student(const student& s) {
   strcpy(name, s.name);
   strcpy(dept, s.dept);
}


person * student::clone() const {
   return new student(*this);
}


void student::display(char * buffer) const {
   sprintf(buffer, "STUDENT: %s (%s)", name, dept);
}


instructor::instructor(const instructor& i) {
   strcpy(name, i.name);
   strcpy(dept, i.dept);
   salary = i.salary;
}


person * instructor::clone() const {
   return new instructor(*this);
}


void instructor::display(char * buffer) const {
   sprintf(buffer, "INSTRUCTOR: %s (%s) %d", name, dept, salary);
}


programmer::programmer(const programmer& p) {
   strcpy(name,    p.name);
   strcpy(company, p.company);
   salary = p.salary;
}


person * programmer::clone() const {
   return new programmer(*this);
}


void programmer::display(char * buffer) const {
   sprintf(buffer, "PROGRAMMER: %s (%s) %d", name, company, salary);
}