Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Add the classes EmpleadoFijo and Project, in such a way that the following structure: Fixed Employee Class: The constructor receives as parameters the

1. Add the classes EmpleadoFijo and Project, in such a way that the
following structure:
Fixed Employee Class:
The constructor receives as parameters the name, id and base salary
The calculateSueldo method updates the salary attribute by removing 16% of
taxes.
The printData method prints the name, salary and the message You are an employee.
company landline(NOTE: It does not print the ID)
Project Class:
The print data method only displays the project name, number, and
of weeks and the NAME OF THE leading EMPLOYEE (NOTE: Only print the name
of the employee, not the ID or the salary.
To check that these classes work, in the main file:
Generates a fixed employee type object with initial data, calculates his salary and
print your data on the screen
Generates a project type object assigning the previous employee as leader.
Prints project data on screen
2. Apply polymorphism in the calculateSalary and printData methods, so
so that the salary is calculated according to the data of each employee
3. Generate another object of type FixedEmployee, another of type ExternalEmployee and
another of type Project. Calculate the salaries of the two employees and Print the data of the
Project object
4. Generate an arrangement of 4 employees (2 permanent and two external). Subsequently,
Through a cycle, it calculates your salary and prints your data. Remember that for this you must
use an Employee object structure and generate objects with the new operator.
Here is the initial code to complete.
#ifndefEXTERNALEMPLOYEE_H
#defineEXTERNALEMPLOYEE_H
#include
class ExternalEmployee : public Employee
{
public:
ExternalEmployee();
virtual ~ExternalEmployee();
ExternalEmployee(string,int,int);
void setNumHours(int);
int getNumHours();
void calculateSalary();
void printData();
protected:
private:
int numHours;
};
#endif // EXTERNALEMPLOYEE_H
#include "ExternalEmployee.h"
ExternalEmployee::ExternalEmployee()
{
//ctor
}
ExternalEmployee::ExternalEmployee(string a,int b, int c):Employee(a,b)
{
numHours=c;
}
void ExternalEmployee::setNumHours(int x){
numHours=x;
}
intExternalEmployee::getNumHours(){
return numHours;
}
void ExternalEmployee::calculateSalary(){
salary=numHours*850;
}
void ExternalEmployee::printData(){
cout<<"Employee "<
#include
using namespace std;
class Employee
{
public:
Employee();
virtual ~Employee();
Employee(string,int);
void setName(string);
string getName();
void setId(int);
int getId();
void calculateSalary();
void printData();
protected:
string name;
int id;
float salary;
private:
};
#endif // EMPLOYEE_H
#include "Employee.h"
Employee::Employee()
{
name="sd";
id=0;
salary=0.0;
}
Employee::~Employee()
{
//dtor
}
Employee::Employee(string x, int y){
name=x;
id=y;
}
void Employee::setName(string x){
name=x;
}
string Employee::getName(){
return name;
}
void Employee::setId(int x){
id=x;
}
int Employee::getId(){
return id;
}
void Employee::calculateSalary(){
salary=0;
}
void Employee::printData(){
cout<<"Employee number "<
#include "ExternalEmployee.h"
using namespace std;
int main()
{
cout<<"Activity submitted by :"<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions

Question

Describe the major barriers to the use of positive reinforcement.

Answered: 1 week ago