Part (A)
Note: This class must be created in a separate cpp file Create a class Employee with the following attributes and operations:
Attributes (Data members):
i. An array to store the employee name. The length of this array is 256 bytes.
ii. An array to store the company name. The length of this array is 256 bytes.
iii. An array to store the department name. The length of this array is 256 bytes.
iv. An unsigned integer to store the employee’s Id.
v. A double variable to store the employee’s annual salary.
Operations (Member functions):
i. Parameterized constructor: This constructor takes in the following arguments:
a. The address of an array which stores the employee’s name.
b. Employee’s Id.
c. Employee’s annual salary.
ii. Default destructor.
iii. SetCompanyName: This function takes in the following argument:
a. The address of an array which stores the company’s name
iv. SetDepartmentName: This function takes in the following argument:
a. The address of an array which stores the department’s name
v. GetEmployeeName: This function has the following arguments:
a. char *pBuffer. This buffer will return the employee’s name.
b. unsigned int bufferSize. The size of the buffer. If the bufferSize is smaller than the length of the employee’s name, this function will return without writing the employee’s name into pBuffer.
vi. GetEmployeeId: This function directly returns the employee’s Id.
vii. GetAnnualSalary: Unlike GetEmployeeId, this function returns the employee’s annual salary as an output argument.
Part (B) Note: This class must be created in a separate cpp file
Based on the Employee class of Part (A), create a class Manager, which is derived from the class Employee (hint: Inheritance applies here). This class has the following attributes and operation:
Attributes (Data members):
i. An unsigned integer to store the number of slaves
ii. Two double variables to store the bonus and financial budget variables respectively
Operations (Member functions):
i. Parameterized constructor: This constructor takes in the same arguments of class Employee’s constructor.
ii. Default destructor
iii. SetNoSlaves. This function takes in the following argument:
a. Number of slaves assigned to the manager.
iv. SetFinancialBudget. This function takes in the following argument:
a. Financial budget as a double value.
v. CalculateBonus. This function calculates and returns the bonus for the manager based on the following formula:
a. Bonus = (Salary * (Slaves * 5%)) + (Financial budget * 10%)
Part (C) Note: This class must be created in a separate cpp file
Based on the Employee class of Part (A), create a class Engineer, which is derived from the class Employee (hint: Inheritance applies here). This class has the following attributes and operation:
Attributes (Data members):
iii. An unsigned integer to store the number of masters
iv. One double variable to store the bonus Operations (Member functions):
vi. Parameterized constructor: This constructor takes in the same arguments of class Employee’s constructor.
vii. Default destructor
viii. SetNoMasters. This function takes in the following argument: a. Number of masters assigned to the engineer.
ix. CalculateBonus. This function calculates and returns the bonus for the manager based on the following formula: a. Bonus = (Salary - (Masters * 10%))
Part (D) Note: This driver program must be created in a separate cpp file
Write a driver program to test the classes created in Parts A, B & C above. Your drive program should prompt the user to enter company name, department name followed by a manager’s name, id & salary and an engineer’s name, id & salary. Test the member functions of both the Manager and Engineer classes accordingly.
Please provide complete solution urgently. For reference
Employee.cpp
#include <string.h>
class Employee
{
public:
char name[256], company[256], department[256];
unsigned int id;
double salary;
Employee(char *emp_name, unsigned int emp_id, double ann_salary)
{
strcpy(name, emp_name);
id = emp_id;
salary = ann_salary;
}
Employee()
{
}
void SetCompanyName(char *comp_name)
{
strcpy(company, comp_name);
}
void SetDepartmentName(char *dept)
{
strcpy(department, dept);
}
void GetEmployeeName(char *pBuffer, unsigned int bufferSize)
{
if(bufferSize >= strlen(name))
{
strcpy(pBuffer, name);
}
}
unsigned int GetEmployeeId()
{
return id;
}
void GetAnnualSalary(double *ann_salary)
{
*ann_salary = salary;
}
};
Employee.cpp Screenshot
Manager.cpp
class Manager: public Employee
{
public:
unsigned int slaves_count;
double bonus, financial_budget;
Manager(char *emp_name, unsigned int emp_id, double ann_salary)
{
strcpy(name, emp_name);
id = emp_id;
salary = ann_salary;
}
Manager()
{
}
void SetNoSlaves(unsigned int slaves_no)
{
slaves_count = slaves_no;
}
void SetFinancialBudget(double f_budget)
{
financial_budget = f_budget;
}
double CalculateBonus()
{
bonus = salary*(slaves_count*0.05) + financial_budget*0.1;
return bonus;
}
};
Manager.cpp Screenshot
Engineer.cpp
class Engineer: public Employee
{
public:
unsigned int masters_count;
double bonus;
Engineer(char *emp_name, unsigned int emp_id, double ann_salary)
{
strcpy(name, emp_name);
id = emp_id;
salary = ann_salary;
}
Engineer()
{
}
void SetNoMasters(unsigned int masters_no)
{
masters_count = masters_no;
}
double CalculateBonus()
{
bonus = salary-(masters_count*0.1);
return bonus;
}
};
Engineer.cpp Screenshot
main.cpp
#include <iostream>
#include "Employee.cpp"
#include "Manager.cpp"
#include "Engineer.cpp"
using namespace std;
int main()
{
char company[256], dept[256], manager_name[256], engineer_name[256], emp_name[256];
unsigned int manager_id, engineer_id;
double manager_salary, engineer_salary, emp_salary;
cout << "Enter company name: ";
cin >> company;
cout << "Enter department name: ";
cin >> dept;
cout << "Enter manager name: ";
cin >> manager_name;
cout << "Enter manager id: ";
cin >> manager_id;
cout << "Enter manager salary: ";
cin >> manager_salary;
cout << "Enter engineer name: ";
cin >> engineer_name;
cout << "Enter engineer id: ";
cin >> engineer_id;
cout << "Enter engineer salary: ";
cin >> engineer_salary;
Manager man(manager_name, manager_id, manager_salary);
man.SetCompanyName(company);
man.SetDepartmentName(dept);
man.SetNoSlaves(1);
man.SetFinancialBudget(1000);
man.GetEmployeeName(emp_name, 256);
cout << "Manager Name : " << emp_name << endl;
cout << "Manager ID : " << man.GetEmployeeId() << endl;
man.GetAnnualSalary(&emp_salary);
cout << "Manager Salary: " << emp_salary << endl;
cout << "Manager Bonus : " << man.CalculateBonus() << endl;
Engineer eng(engineer_name, engineer_id, engineer_salary);
eng.SetCompanyName(company);
eng.SetDepartmentName(dept);
eng.SetNoMasters(1);
eng.GetEmployeeName(emp_name, 256);
cout << "Engineer Name : " << emp_name << endl;
cout << "Engineer ID : " << eng.GetEmployeeId() << endl;
eng.GetAnnualSalary(&emp_salary);
cout << "Engineer Salary: " << emp_salary << endl;
cout << "Engineer Bonus : " << eng.CalculateBonus() << endl;
}
main.cpp Screenshot
Output
Each and every thing is clearly coded according to the given information. Used all the methods for both manger object and engineer object also the inherited methods. Not provided any comments since each and every thing is very clear regarding the information provided.
Please place these files in the same folder.
Hope this may help you
Thank you ??
Part (A) Note: This class must be created in a separate cpp file Create a class...
You must create a Java class named TenArrayMethods in a file named TenArrayMethods.java. This class must include all the following described methods. Each of these methods should be public and static.Write a method named getFirst, that takes an Array of int as an argument and returns the value of the first element of the array. NO array lists. Write a method named getLast, that takes an Array of int as an argument and returns the value of the last element...
Create a c++ code and answer number 1 Homework Ch. 13 - Employee Class 30 points Design a class named Employee that has the following attributes: * Name ID Number- (Employee's] Identification Number " Department-the name of the department where the employee works " Position-the employee's job title The class should have the following constructors: A constructor that accepts values for all the member data as arguments A constructor that accepts the following values as arguments and assigns them to...
c++ only Design a class representing an Employee. The employee would have at least these private fields (Variables): name: string (char array) ID: string (char array) salary: float Type: string (char array) All the variables except for the salary should have their respective setters and getters, and the class should have two constructors, one is the default constructor and the other constructor initializes the name,ID and type of employee with valid user input. The class should have the following additional...
In one file create an Employee class as per the following specifications: three private instance variables: name (String), startingSalary (int), yearlyIncrement (int) a single constructor with three arguments: the name, the starting salary, and the yearly increment. In the constructor, initialize the instance variables with the provided values. get and set methods for each of the instance variables. A computation method, computeCurrentSalary, that takes the number of years in service as its argument. The method returns the current salary using...
This is done in C++ Create an Employee class using a separate header file and implementation file. Review your UML class diagram for the attributes and behaviors The calculatePay() method should return 0.0f. The toString() method should return the attribute values ("state of the object"). Create an Hourly class using a separate header file and implementation file. The Hourly class needs to inherit from the Employee class The calculatePay() method should return the pay based on the number of hours...
My main() file does not call to the class created in a .hpp file. It comes out with the error "undefined reference to "___" const. I want to solve this by only changing the main() .cpp file, not the .hpp file. .cpp file .hpp file Thank you! include <iostream> include <string> tinclude "CourseMember.hpp using namespace std int main0 CourseMember CourseMember(90, "Jeff", "Goldblum"): // initializing the constructor cout<< "Member ID is <<CourseMember.getID) << endl; 1/ calling getID) accessor cout <<"First Name...
create java application with the following specifications: -create an employee class with the following attibutes: name and salary -add constuctor with arguments to initialize the attributes to valid values -write corresponding get and set methods for the attributes -add a method in Employee called verify() that returns true/false and validates that the salary falls in range1,000.00-99,999.99 Add a test application class to allow the user to enter employee information and display output: -using input(either scanner or jOption), allow user to...
Java Description Write a program to compute bonuses earned this year by employees in an organization. There are three types of employees: workers, managers and executives. Each type of employee is represented by a class. The classes are named Worker, Manager and Executive and are described below in the implementation section. You are to compute and display bonuses for all the employees in the organization using a single polymorphic loop. This will be done by creating an abstract class Employee...
It must be C++ Chapter 13 Programming Challenge 2: Employee Class. See instruction: Chapter 13 Programming Challenge 2 Employee Class.pdf Program Template: // Chapter 13, Programming Challenge 2: Employee Class #include <iostream> #include <string> using namespace std; // Employee Class Declaration class Employee { private: string name; // Employee's name int idNumber; // ID number string department; // Department name string position; // Employee's position public: // TODO: Constructors // TODO: Accessors // TODO: Mutators }; // Constructor #1 Employee::Employee(string...
Write a code in C++ by considering the following conditions :- Tasks :- 1. Create a class Employee (with member variables: char * name, int id, and double age). 2. Create a constructor that should be able to take arguments and initialize the member variables. 3. Create a copy constructor for employee class to ensure deep copy. 4. Create a destructor and de allocate the dynamic memory. 5. Overload the assignment operator to prevent shallow copy and ensure deep copy....