#include// Standard class headers, inc. inheritance tree definition class person { public: void setage(int years); int getage(); char *getname(); char *name; private: int years; }; class employee: public person { public: employee(char *name, int age, float monthly); float getcost(); private: float monthly; }; class customer: public person { public: customer(char *name, int age, float annual); float getcost(); private: float annual; }; // Code for the invidivual classes void person::setage(int years) { this->years = years; } int person::getage() { return this->years; } /* years would have been just as good */ employee::employee(char *name, int age, float monthly) { this->name = name; this->setage(age); this->monthly = monthly; } customer::customer(char *name, int age, float annual) { this->name = name; this->setage(age); this->annual = annual; } float employee::getcost() { return (65 - this->getage() ) * 12.0 * monthly; } float customer::getcost() { return -annual * (65 - this->getage()); } char *person::getname() { return name; } // Test application int main() { employee george("George Foreman",23,150000.); employee debbie("Debbie Harry",28,1000.); customer henry("Henry Ford",25,5000.); customer bert("Bert Fry",40,15000.); float balance = 0.0; float addbal = george.getcost(); int perage = george.getage(); char *whom = george.getname(); cout << whom << "\n"; cout << addbal << " " << perage << "\n"; balance += addbal; addbal = debbie.getcost(); perage = debbie.getage(); whom = debbie.getname(); cout << whom << "\n"; cout << addbal << " " << perage << "\n"; balance += addbal; addbal = henry.getcost(); perage = henry.getage(); whom = henry.getname(); cout << whom << "\n"; cout << addbal << " " << perage << "\n"; balance += addbal; addbal = bert.getcost(); perage = bert.getage(); whom = bert.getname(); cout << whom << "\n"; cout << addbal << " " << perage << "\n"; balance += addbal; cout << balance << "\n"; }