Knowee
Questions
Features
Study Tools

Write a C++ program to implement a class called Employee that has member variables for name, ID, appraisal_score A (out of 10) and salary. Include member functions to calculate salary based on employee performance. Create object and call the member function and print the results.If A>5 and A<8  - increment is 60% of his old salaryIf A>=8   - increment is 80% of his old salaryIf A>= 2 & A<=5-  increment is 40 % of his old salaryIf A=1 -No incrementnew salary=increment+old_salarySample InputJeny223300006Sample OutputJeny increment is 18000Jeny new salary is 48000

Question

Write a C++ program to implement a class called Employee that has member variables for name, ID, appraisal_score A (out of 10) and salary. Include member functions to calculate salary based on employee performance. Create object and call the member function and print the results.If A>5 and A<8  - increment is 60% of his old salaryIf A>=8   - increment is 80% of his old salaryIf A>= 2 & A<=5-  increment is 40 % of his old salaryIf A=1 -No incrementnew salary=increment+old_salarySample InputJeny223300006Sample OutputJeny increment is 18000Jeny new salary is 48000

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

Solution 1

Here is the C++ program that implements the Employee class with the specified member variables and functions:

#include<iostream>
#include<string>
using namespace std;

class Employee {
    string name;
    int ID;
    int appraisal_score;
    double salary;

public:
    Employee(string n, int id, int a, double s) {
        name = n;
        ID = id;
        appraisal_score = a;
        salary = s;
    }

    void calculateSalary() {
        double increment = 0;
        if (appraisal_score > 5 && appraisal_score < 8) {
            increment = salary * 0.6;
        } else if (appraisal_score >= 8) {
            increment = salary * 0.8;
        } else if (appraisal_score >= 2 && appraisal_score <= 5) {
            increment = salary * 0.4;
        } else if (appraisal_score == 1) {
            increment = 0;
        }
        salary += increment;
        cout << name << " increment is " << increment << endl;
        cout << name << " new salary is " << salary << endl;
    }
};

int main() {
    Employee e("Jeny", 2233, 6, 30000);
    e.calculateSalary();
    return 0;
}

This program first defines the Employee class with member variables for name, ID, appraisal_score, and salary. The constructor initializes these variables. The calculateSalary() function calculates the salary increment based on the appraisal_score and updates the salary. In the main function, an Employee object is created and the calculateSalary() function is called to calculate and print the new salary.

This problem has been solved

Solution 2

Here is a C++ program that implements the Employee class as per your requirements:

#include<iostream>
#include<string>
using namespace std;

class Employee {
    string name;
    int ID;
    int appraisal_score;
    double salary;

public:
    Employee(string n, int id, int a, double s) {
        name = n;
        ID = id;
        appraisal_score = a;
        salary = s;
    }

    void calculateSalary() {
        double increment = 0;
        if (appraisal_score > 5 && appraisal_score < 8) {
            increment = salary * 0.6;
        } else if (appraisal_score >= 8) {
            increment = salary * 0.8;
        } else if (appraisal_score >= 2 && appraisal_score <= 5) {
            increment = salary * 0.4;
        } else if (appraisal_score == 1) {
            increment = 0;
        }
        salary += increment;
        cout << name << " increment is " << increment << endl;
        cout << name << " new salary is " << salary << endl;
    }
};

int main() {
    Employee e("Jeny", 2233, 6, 30000);
    e.calculateSalary();
    return 0;
}

This program first defines the Employee class with member variables for name, ID, appraisal_score, and salary. The class also includes a member function calculateSalary() to calculate the salary based on the employee's performance. In the main() function, an Employee object is created and the calculateSalary() function is called to calculate and print the new salary.

This problem has been solved

Solution 3

Here is the C++ program that implements the Employee class and calculates the salary based on the employee's performance:

#include<iostream>
#include<string>
using namespace std;

class Employee {
    string name;
    int ID;
    int appraisal_score;
    double salary;

public:
    Employee(string n, int id, int a, double s) {
        name = n;
        ID = id;
        appraisal_score = a;
        salary = s;
    }

    void calculateSalary() {
        double increment = 0;
        if (appraisal_score > 5 && appraisal_score < 8) {
            increment = salary * 0.6;
        } else if (appraisal_score >= 8) {
            increment = salary * 0.8;
        } else if (appraisal_score >= 2 && appraisal_score <= 5) {
            increment = salary * 0.4;
        } else if (appraisal_score == 1) {
            increment = 0;
        }
        salary += increment;
        cout << name << " increment is " << increment << endl;
        cout << name << " new salary is " << salary << endl;
    }
};

int main() {
    Employee e("Jeny", 2233, 6, 30000);
    e.calculateSalary();
    return 0;
}

In this program, we first define the Employee class with member variables for name, ID, appraisal_score, and salary. We also define a constructor to initialize these variables and a member function calculateSalary() to calculate the new salary based on the appraisal score. In the main function, we create an Employee object and call the calculateSalary() function to calculate and print the new salary.

This problem has been solved

Solution 4

Here is a simple C++ program that implements the Employee class with the required member variables and functions:

#include<iostream>
#include<string>
using namespace std;

class Employee {
    string name;
    int ID;
    int appraisal_score;
    double salary;

public:
    Employee(string n, int id, int a, double s) {
        name = n;
        ID = id;
        appraisal_score = a;
        salary = s;
    }

    void calculateSalary() {
        double increment = 0;
        if (appraisal_score > 5 && appraisal_score < 8) {
            increment = salary * 0.6;
        } else if (appraisal_score >= 8) {
            increment = salary * 0.8;
        } else if (appraisal_score >= 2 && appraisal_score <= 5) {
            increment = salary * 0.4;
        } else if (appraisal_score == 1) {
            increment = 0;
        }
        salary += increment;
        cout << name << " increment is " << increment << endl;
        cout << name << " new salary is " << salary << endl;
    }
};

int main() {
    Employee e("Jeny", 2233, 6, 30000);
    e.calculateSalary();
    return 0;
}

This program first defines the Employee class with the required member variables and functions. The calculateSalary function calculates the salary increment based on the appraisal score and updates the salary. In the main function, an Employee object is created and the calculateSalary function is called to calculate and print the new salary.

This problem has been solved

Solution 5

Here is a simple C++ program that implements the Employee class as per your requirements:

#include<iostream>
#include<string>
using namespace std;

class Employee {
    string name;
    int ID;
    int appraisal_score;
    double salary;

public:
    Employee(string n, int id, int a, double s) {
        name = n;
        ID = id;
        appraisal_score = a;
        salary = s;
    }

    void calculateSalary() {
        double increment = 0;
        if (appraisal_score > 5 && appraisal_score < 8) {
            increment = salary * 0.6;
        } else if (appraisal_score >= 8) {
            increment = salary * 0.8;
        } else if (appraisal_score >= 2 && appraisal_score <= 5) {
            increment = salary * 0.4;
        } else if (appraisal_score == 1

This problem has been solved

Similar Questions

Design a structure in C to represent an employee's information, including their name, employee ID, department, and salary. Additionally, write a program that allows users to input employee data, display employee information, and update an employee's salary. write a code for demonstrating the implementation of the structure and program functionalities.input and output Enter employee details:Enter employee name: John DoeEnter employee ID: 101Enter department: SalesEnter salary: 50000Employee Information:Name: John Employee ID: 101 Department:Sales Salary: 50000.00Enter new salary: 55000Salary updated successfully.Updated Employee Information:Name: JohnEmployee ID: 101Department: SalesSalary: 55000.00

Write a C program to store the information of employees in a company using structures. Each employee should have the following details:Employee code (integer)Employee name (string)Salary (float)Department number (integer)The program should allow the user to input the number of employees (n) and then input the details of each employee. i.Display the employee name with the maximum salary.ii. Display the average salary of all employees in the company.Test Case:3 // number of employees101  //Enter employee code:John Doe // Enter employee name:50000.00 // Enter salary:1  // Enter department number:102Jane Smith60000.001103Suresh Raina55000.002Output:Jane Smith55000.00  // avg of all employees salary

Problem StatementIn a corporate office, HR wants to implement a program to input an employee's ID and salary. Your task is to assist him in using pointers to efficiently manage and print the employee details, displaying the ID and salary for accurate record-keeping.Input format :The first line of input consists of an integer, representing the employee ID.The second line consists of a float value, representing the salary of the employee.Output format :The first line of output prints "ID: " followed by the employee ID, as an integer.The second line prints "Salary: " followed by the salary of the employee, as a float value, rounded off to two decimal places.

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.

Create a Java  base class called Employee. Use this class to store two double-type values that could be used to compute the salary of employees. Also,the base class should have a static variable ‘totalemp’  to keep track of the total number of employees created. Derive two specific classes called part_time and full_time from the base employee. Add a member function called as get_basic() to get the basic pay and another member called display_salary() to compute and display the salary of the employees. Using these three classes, design a program that will accept the basic pay of part_time and full_time employees interactively. Remember the two values given as input will be treated as the basic pay of the employees and the following information is used for calculating the salaries of both the part-time as well as full-time employees. Print invalid if the basic_salary of part-time employee and basic_salary of full-time employee are not met the ”Boundary Condition”Part time                                         Full timeHRA = 20% of basic pay                    HRA = 30% of basic payDA = 72% of basic pay                      DA = 80% of basic paySalary = Basic + HRA + DA              Salary = Basic + HRA + DABoundary Condition:0 < basic_salary of part-time employee <= 10000000 < basic_salary of full-time employee <= 1000000Input Format:First line to enter the basic_salary of part-time employee and basic_salary of full-time employeeOutput Format:Total salary of part-time employee and total salary of full-time employee.Total number of employees processed Sample Testcase Input-1:50007000000Sample Testcase Output-1:8900.0invalid1 Sample Testcase Input-2:30000600000Sample Testcase Output-2:42720.0110400.02 Sample Testcase Input-3:0900000Sample Testcase Output-3:invalid216000.01

1/3

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.