Question: C++ Program - Implement Random Access Binary Files. Do Not use Arrays instead write the data directly to Random Access Binary File. New program should
C++ Program - Implement Random Access Binary Files. Do Not use Arrays instead write the data directly to Random Access Binary File.
New program should be modified to display a menu for the user to do the following:
1. Replace Employee and Department classes with Employee and Department Structures.
2. Inside each structure, replace all string variables with array of characters.
3. Make Employee and Department editable. That means, the user should be able to edit a given Employee and Department.
4. Do not allow the user to edit the Employee ID and Department ID.
5. Use Random Access Files to store the data in Binary Form. This means, you should not use an Arrays to store the data in the memory. Instead, when the user wants to create a new Employee/Department, you write it to the file right away. Also when the user says he/she wants to edit an Employee/Department, ask the user to enter EmployeeID/DepartmentID. Read the data from the file and display it to the user. Allow the user to enter new data and write it back to the file in the same position inside the file.
Instructions for original (c++) program.
1. Create 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 7 and another one for Department with the size 3.
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 copy 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 copy the Employee object into the array. Also make sure that the DepartmentID that the employee belongs also exists. 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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
