Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Write a program to allow the user to: 1. Create two classes. Employee and De

ID: 3911156 • Letter: C

Question

C++

Write a program to allow the user to:

1. Create two classes. Employee and Departments.

The Department class will have: DepartmentID, Departmentname, DepartmentHeadName.

The Employee class will have employeeID, emploeename, employeesalary, employeeage, employeeDepartmentID.

Both of the above classes should have appropriate constructors, accessor methods.

2. Create two arrays . One for Employee with the size 5 and another one for Department with the size 3.

Your program should display a menu for the user to do the following:

1. Create Department. Collect all information about a department. Make sure the department ID does not already exist in the array containing Department objects. If it does not, then insert the Department object into the array. When the array is full, display the error message to the user "The array is full, you can not add any more departments"

2. Create Employee. Collect all information about an Employee. Make sure the Employee ID does not already exist in the array containing Employee objects. If it does not, then insert the Employee object into the array. Also make sure that the DepartmentID that the employee belongs also exists. If it does not, then display error message.
When the array is full, display the error message to the user "The array is full, you can not add any more Employees"

3. Write the data to the file. When the user selects this option, dump the information in each array into a separate file.

4. Retrieve data from file. When user selects this option, open each file, load the data from the file into the appropriate array.

5. Display Report: When user selects this option, go through arrays and display the total salary paid for each department. The report should display the department name and the total salary of all employees in that department.

PLEASE TAKE A PICTURE OF YOUR OUTPUT WITH THE FOLLOWING OUT I HAVE GIVEN IT HAS TO BE THE SAME.

output has to be the same as the following:

Explanation / Answer

//Employee Class Program

#ifndef Employee_Header

#include <sstream>

#include <iostream>

#include <string>

using namespace std;

class Employee

{

private:

string name;

string idnumber;

string department;

string position;

public:

Employee ();

Employee (string n, string id, string dept, string pos);

string getNAME()

{

return name;

}

string getID()

{

return idnumber;

}

string getDEPT()

{

return department;

}

string getPOS()

{

return position;

}

};

Employee::Employee (string n, string id, string dept, string pos)

{

name=n;

idnumber=id;

department=dept;

position=pos;

}

void Employee()

{

string name=" ";

string idnumber = 0;

string department = " ";

string position = " ";

};

#endif

//Employee Class Program

#include "EmployeeClass.h"

#include <iostream>

#include <string>

using namespace std;

int main(int argc, char *argv[])

{

QApplication a(argc, argv);

MainWindow w;

w.show();

const int number = 3;

Employee *objects[number];

objects[0] = new Employee("Susan Meyers", "47899", "Accounting", "Vice President");

objects[1] = new Employee("Mark Jones", "39119", "IT", "Programmer");

objects[2] = new Employee("Roy Rogers", "81774", "Manufacturing", "Engineer");

for(int i = 0; i < number; i++)

{

cout << objects[i]->getNAME() << " ";

cout << objects[i]->getID() << " ";

cout << objects[i]->getDEPT() << " ";

cout << objects[i]->getPOS() << endl;

};

cin.ignore();

cin.get();

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote