Click to go home
// class Student implementation
#include "Student.hpp"
#include < usual.h>
Student::Student() // default constructor
:Employee(),subsidy(0){}
Student::Student(char* nm,float monthly,float subsdy) // constructor
:Employee(nm,monthly),subsidy(subsdy){calcPay();} // with char string
Student::Student(char ch,float monthly,float subsdy) // constructor
:Employee(ch,monthly),subsidy(subsdy){calcPay();} // with char
Student::Student(String& obj,float monthly,float subsdy) // constructor
:Employee(obj,monthly),subsidy(subsdy){calcPay();} // accepting a
// string object
Student::Student(Student& obj) // copy constructor
:Employee(obj.getName(),obj.getMonthlySalary()),subsidy(obj.subsidy){calcPay();}
Student::~Student(){} // destructor
Student& Student::operator =(Student& obj) // =operator overload
{
setName(obj.getName());
setMonthlySalary(obj.getMonthlySalary());
subsidy=obj.subsidy;
calcPay();
return obj;
}
float Student::getSubsidy() // returns subsidy
{return subsidy;}
void Student::setSubsidy(float subsdy) // changes value of subsidy
{subsidy=subsdy;}
void Student::calcPay() // calculates grossPay
{grossPay=getMonthlySalary()+subsidy;}
void Student::display() // displays data members, including inherited
{
Employee::display();
cout<<"\nSubsidy: $"<< subsidy;
}
Next Page - Driver
Jump to:
hpp |
Employee.cpp |
FullTime.cpp |
SalesPerson.cpp |
String.cpp
Go to top