Knowee
Questions
Features
Study Tools

Amazon has recently updated the salary structure for its employees in various designations. The employees are classified into three main groups: Project Managers, System Engineers, and Technical Assistants. Each designation has different allowances added to their basic pay(if basic pay=0,then salary=0). Project Managers receive all allowances(Additional Grade Pay, Dearness Allowance, House Rental Allowance) except Travel Allowances (TA). System Engineers receive only basic pay and TA, while Technical Assistants receive only fixed basic pay without any allowances. Implement this salary scheme in a C++ program where the base class Employee represents all employees' common attributes and behaviours. ProjectManager, SystemEngineer, and TechnicalAssistant should be derived classes from Employee.The Employee class should have a constructor to initialize common attributes like name and basic pay, and each derived class should have its own constructor to initialize its specific attributes.Write a main() function to display the salary with respective class objects.

Question

Amazon has recently updated the salary structure for its employees in various designations. The employees are classified into three main groups: Project Managers, System Engineers, and Technical Assistants. Each designation has different allowances added to their basic pay(if basic pay=0,then salary=0). Project Managers receive all allowances(Additional Grade Pay, Dearness Allowance, House Rental Allowance) except Travel Allowances (TA). System Engineers receive only basic pay and TA, while Technical Assistants receive only fixed basic pay without any allowances. Implement this salary scheme in a C++ program where the base class Employee represents all employees' common attributes and behaviours. ProjectManager, SystemEngineer, and TechnicalAssistant should be derived classes from Employee.The Employee class should have a constructor to initialize common attributes like name and basic pay, and each derived class should have its own constructor to initialize its specific attributes.Write a main() function to display the salary with respective class objects.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Here is a simple implementation of the salary scheme in C++:

#include<iostream>
using namespace std;

class Employee {
    protected:
        string name;
        double basicPay;
    public:
        Employee(string n, double bp) : name(n), basicPay(bp) {}
        virtual double calculateSalary() = 0; // Pure virtual function
};

class ProjectManager : public Employee {
    private:
        double gradePay;
        double dearnessAllowance;
        double houseRentAllowance;
    public:
        ProjectManager(string n, double bp, double gp, double da, double hra) : Employee(n, bp), gradePay(gp), dearnessAllowance(da), houseRentAllowance(hra) {}
        double calculateSalary() {
            return basicPay + gradePay + dearnessAllowance + houseRentAllowance;
        }
};

class SystemEngineer : public Employee {
    private:
        double travelAllowance;
    public:
        SystemEngineer(string n, double bp, double ta) : Employee(n, bp), travelAllowance(ta) {}
        double calculateSalary() {
            return basicPay + travelAllowance;
        }
};

class TechnicalAssistant : public Employee {
    public:
        TechnicalAssistant(string n, double bp) : Employee(n, bp) {}
        double calculateSalary() {
            return basicPay;
        }
};

int main() {
    ProjectManager pm("John", 50000, 10000, 5000, 2000);
    SystemEngineer se("Jane", 40000, 3000);
    TechnicalAssistant ta("Joe", 30000);

    cout << "Salary of Project Manager: " << pm.calculateSalary() << endl;
    cout << "Salary of System Engineer: " << se.calculateSalary() << endl;
    cout << "Salary of Technical Assistant: " << ta.calculateSalary() << endl;

    return 0;
}

In this program, Employee is the base class with common attributes like name and basicPay. ProjectManager, SystemEngineer, and TechnicalAssistant are derived classes from Employee with their own specific attributes. The calculateSalary() function is a pure virtual function in the base class and is overridden in each derived class to calculate the salary according to the given rules. The main() function creates objects of each class and displays their salaries.

This problem has been solved

Similar Questions

ABC company Ltd. is interested to computerize the pay calcuation of their employee in the form of Basic pay, Dearness Allowance (DA) and House Rent Allowance (HRA). DA and HRA are calculated as certain % of Basic pay (For example, DA is 80% of Basic pay, and HRA is 30% of Basic pay). They have the deduction in the salary as PF which is 12% of Basic pay. Propose a computerized solution for the above said problem.

For the Employee Class Program in this tutorial, what if we need the capability to update the salary for employees? What information is needed to perform this task, and what code segment implements obtaining it in a method?a.)Employees file information and the new salarydef upd_salary(): employees = read_employees() new_sal = input("Enter the new salary of the employee: ")b.)The new salarydef upd_salary(employees): new_sal = input("Enter the new salary of the employee: ")c.)Employee iddef upd_salary(employees): empid = input("Enter the employee ID: ")d.)Employee id and the new salarydef upd_salary(employees): empid = input("Enter the employee ID: ") new_sal = input("Enter the new salary of the employee: ")

Implement a C++ program to manage the salary structure for employees at a university, including Head of Department (HOD), Faculty, and Technical Assistants. Begin by defining a base class Employee with common attributes name and basicPay. Create derived classes, such as HOD, Faculty, and TechnicalAssistant, that are inherited from the employee. Each derived class should have its own method, calculateSalary(), to compute the total salary based on its specific attributes and the basic pay. The salary should also include a bonus based on the overall salary:If the overall salary is less than 50,000, the bonus is 5% of the overall salary.If the overall salary is between 50,000 and 100,000, the bonus is 7% of the overall salary.If the overall salary is more than 100,000, the bonus is 10% of the overall salary.HODs receive additional grade pay, dearnessAllowance, house RentalAllowance, and travelAllowance; faculty receive house RentalAllowance and travelAllowance; and Technical Assistants receive the basic pay and travelAllowance. In the main() function, instantiate objects of each employee type with sample data, calculate their total salary and bonus using the calculateSalary() method, and display them.

One method of compensation in a global business is to pay a similar base salary company wide or region wide and offer expatriates an allowance based on specific market conditions in each country. This is known as _____.Group of answer choicesbroadbandingthe balance sheet approachskills-based paycompetence-based paya pay grading system

rect answerA class Manager wants to implement an interface Salary. Which of the following is the correct way of implementing it?

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.