Write a C++ 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 andanother one for Department with the size 3.
Your program should display a menu for the user to do thefollowing:
1. Create Department. Collect all information about adepartment. Make sure the department ID does not already exist inthe array containing Department objects. If it does not, theninsert the Department object into the array. When the array isfull, display the error message to the user \"The array is full, youcan 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 arraycontaining Employee objects. If it does not, then insert theEmployee object into the array. Also make sure that theDepartmentID 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 \"Thearray is full, you can not add any more Employees\"
3. Write the data to the file. When the user selects thisoption, dump the information in each array into a separatefile.
4. Retrieve data from file. When user selects this option, openeach file, load the data from the file into the appropriatearray.
5. Display Report: When user selects this option, go througharrays and display the total salary paid for each department. Thereport should display the department name and the total salary ofall employees in that department.
Test Case
TEST CASE1:1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 1Please Enter Department Details:Department ID : 1Department Name : SalesHead of Department : Anna1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 1Please Enter Department Details:Department ID : 1Value must be unique!1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 1Please Enter Department Details:Department ID : 2Department Name : MarketingHead of Department : Mark1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 1Please Enter Department Details:Department ID : 3Department Name : GlobalSales Head of Department : Patil1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 1The array is full, you can not add any more Departments.1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 2Please Enter Employee Details:Employee ID : 1Employee Name :JohnSalary: $45000Age : 25Department ID : 11. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 2Please Enter Employee Details:Employee ID : 1Value must be unique!1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 1The array is full, you can not add any more Departments.1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 2Please Enter Employee Details:Employee ID : 2Employee Name :SusanSalary: $45000Age : 26Department ID : 11. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 2Please Enter Employee Details:Employee ID : 3Employee Name :AdamSalary: $50000Age : 24Department ID : 21. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 2Please Enter Employee Details:Employee ID : 4Employee Name :MannySalary: $60000Age : 26Department ID : 21. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 2Please Enter Employee Details:Employee ID : 5Employee Name :MariaSalary: $60000Age : 23Department ID : 9Please enter a valid department ID: 31. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 2The array is full, you can not add any more Employees.1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 5Salary Report By DepartmentDept : SalesTotal Salary : $90000Dept : MarketingTotal Salary : $110000Dept : GlobalSalesTotal Salary : $600001. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 9Please enter a valid choice (1 - 6): 31. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 6Thank you, goodbye.TEST CASE 2:1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 1Please Enter Department Details:Department ID : 1Department Name : SalesHead of Department : Markus1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 1Please Enter Department Details:Department ID : 1Value must be unique!1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 1Please Enter Department Details:Department ID : 2Department Name : MarketingHead of Department : Anna1. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 2Please Enter Employee Details:Employee ID : 1Employee Name :JohnSalary: $45000Age : 23Department ID : 11. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 2Please Enter Employee Details:Employee ID : 2 Employee Name :SusanSalary: $40000Age : 45Department ID : 11. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 2Please Enter Employee Details:Employee ID : 3Employee Name :manySalary: $70000Age : 34Department ID : 21. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 5Salary Report By DepartmentDept : SalesTotal Salary : $85000Dept : MarketingTotal Salary : $700001. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 31. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 41. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 5Salary Report By DepartmentDept : SalesTotal Salary : $85000Dept : MarketingTotal Salary : $700001. Create Department2. Create Employee3. Write Out Data File4. Read In Data File5. Display Salary Report6. -- Quit -- Please make a selection : 6Thank you, goodbye.