Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include "Windows.h"
- using namespace std;
- class Employee
- {
- public:
- Employee() : name("dafault"), id(0) {}
- Employee(string name, int id) : name(name), id(id) {}
- ~Employee() {}
- string getName() { return name; }
- int getId() { return id; }
- void setName(string name) { this->name = name; }
- void setId(int id) { this->id = id; }
- void show() { cout << id << " > " + name + "." << endl; }
- protected:
- string name;
- int id;
- };
- class Student
- {
- public:
- Student() : education("no"), degree("no") {}
- Student(string education, string degree) : education(education), degree(degree) {}
- string getEducation() { return education; }
- string getDegree() { return degree; }
- void setEducation(string education) { this->education = education; }
- void setDegree(string degree) { this->degree = degree; }
- protected:
- string education;
- string degree;
- };
- class Manager : private Employee, private Student
- {
- public:
- Manager() : Employee(), Student(), position("default"), fitnessTaxes(0) {}
- Manager(string name, int id, string education, string degree, string position, double fitnessTaxes) : Employee(name, id), Student(education, degree), position(position), fitnessTaxes(fitnessTaxes) {}
- ~Manager() {}
- string getEducation() { return Student::getEducation(); }
- string getDegree() { return Student::getDegree(); }
- string getName() { return Employee::getName(); }
- int getId() { return Employee::getId(); }
- string getPosition() { return position; }
- double getFitnessTaxes() { return fitnessTaxes; }
- void setEducation(string education) { Student::setEducation(education); }
- void setDegree(string degree) { Student::setDegree(degree); }
- void setName(string name) { Employee::setName(name); }
- void setId(int id) { Employee::setId(id); }
- void setPosition(string position) { this->position = position; }
- void setFitnessTaxes(double fitnessTaxes) { this->fitnessTaxes = fitnessTaxes; }
- void show() { cout << id << " > " + name + ", " + position + " pays for fitness " << fitnessTaxes << " bucks." << endl; }
- protected:
- string position;
- double fitnessTaxes;
- };
- class Scientist : private Employee, private Student
- {
- public:
- Scientist() : Employee(), Student(), amountOfArticles(0) {}
- Scientist(string name, int id, string education, string degree, int amountOfArticles) : Employee(name, id), Student(education, degree), amountOfArticles(amountOfArticles) {}
- ~Scientist() {}
- string getEducation() { return Student::getEducation(); }
- string getDegree() { return Student::getDegree(); }
- string getName() { return Employee::getName(); }
- int getId() { return Employee::getId(); }
- int getAmountOfArticles() { return amountOfArticles; }
- void setEducation(string education) { Student::setEducation(education); }
- void setDegree(string degree) { Student::setDegree(degree); }
- void setName(string name) { Employee::setName(name); }
- void setId(int id) { Employee::setId(id); }
- void setAmountOfArticles(int amountOfArticles) { this->amountOfArticles = amountOfArticles; }
- void show() { cout << id << " > " + name + ", published " << amountOfArticles << " articles." << endl; }
- protected:
- int amountOfArticles;
- };
- class Worker : public Employee
- {
- public:
- Worker() : Employee() {}
- Worker(string name, int id) : Employee(name, id) {}
- void show() { cout << id << " > " + name + " is a bricklayer, works for three days, without salary!!!" << endl; }
- ~Worker() {}
- };
- class Brigadier : public Worker
- {
- public:
- Brigadier() : Worker(), productionRate(0.0) {}
- Brigadier(string name, int id, int productionRate) : Worker(name, id), productionRate(productionRate) {}
- ~Brigadier();
- int getProductionRate() { return productionRate; }
- void setProductionRate(int productionRate) { this->productionRate = productionRate; }
- void show() { cout << id << " > " + name + " is brigadier. His production rate is " << productionRate << "%" << endl; }
- protected:
- int productionRate;
- };
- int main()
- {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- Employee * e = new Employee("Todd Howard", 0);
- e->show();
- Manager * m = new Manager("Kim Chen In", 1, "non", "non", "the dictator", 300);
- m->show();
- cout << m->getName() + " finished " + m->getEducation() + " as " + m->getDegree() << endl;
- Scientist * s = new Scientist("Popov", 2, "rsreu", "candidate of science", 150);
- s->show();
- cout << s->getName() + " finished " + s->getEducation() + " as " + s->getDegree() << endl;
- Worker * w = new Worker("Rabotyaga", 3);
- w->show();
- Brigadier * b = new Brigadier("Boss of the gym", 4, 100);
- b->show();
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement