// see comments for expected additions/modifications #include class Employee { public: Employee(std::string n, int s) : name(n), salary(s) {} virtual ~Employee() = default; // not virtual and not abstract in given virtual int getSalary() const = 0; std::string getName() const { return name; } protected: // private in given std::string name; int salary; }; // not given class Boss : public Employee { public: Boss(std::string n, int s, int b) : Employee(n, s), bonus(b) {} int getSalary() const { int profit; std::cout << "Total omsättning denna månad? "; std::cin >> profit; return salary + profit*bonus/100; } private: int bonus; }; // not given class Hourly : public Employee { public: Hourly(std::string n, int s) : Employee(n, s) {} int getSalary() const { int hours; std::cout << "Antal arbetstimmar för " << name << "? "; std::cin >> hours; return hours*salary; } }; // not given class Monthly : public Employee { public: Monthly(std::string n, int s) : Employee(n, s) {} int getSalary() const { int sickdays; std::cout << "Antal sjukdagar för " << name << "? "; std::cin >> sickdays; return salary - sickdays*1000; } }; #include int main() { std::vector v; v.push_back(new Boss("Andersson", 30000, 10)); v.push_back(new Monthly("Pettersson", 24000)); v.push_back(new Hourly("Lundström", 180)); for (unsigned i = 0; i < v.size(); ++i) { std::cout << v.at(i)->getSalary() << "kr skall betalas till " << v.at(i)->getName() << std::endl; } // not given for (unsigned i = 0; i < v.size(); ++i) { delete v.at(i); } return 0; }