Question
Need help fixing this code. keeps saying Severity Code Description Project File Line Suppression State Error C2653 'File': is not a class or namespace name
Need help fixing this code. keeps saying
Severity Code Description Project File Line Suppression State Error C2653 'File': is not a class or namespace name OOP244 C:\Users\balit\OneDrive\Desktop\OOP244\ws02\WS02\OOP244\Employee.cpp 47
and Severity Code Description Project File Line Suppression State Warning C6054 String 'tempName' might not be zero-terminated. OOP244 C:\Users\balit\OneDrive\Desktop\OOP244\ws02\WS02\OOP244\File.cpp 43 this is the code #include
int noOfEmployees; Employee* employees;
void sort() { int i, j; Employee temp; for (i = noOfEmployees - 1; i > 0; i--) { for (j = 0; j employees[j + 1].m_empNo) { temp = employees[j]; employees[j] = employees[j + 1]; employees[j + 1] = temp; } } } }
// Implementation of the 1 arg load function bool load(Employee& emp) { bool ok = false; char name[128]; int empNo; double salary;
// Read employee number if (File::read(empNo)) { // Read employee salary if (File::read(salary)) { // Read employee name if (File::read(name)) { // Allocate memory for the name and copy it emp.m_name = new char[strlen(name) + 1]; strcpy(emp.m_name, name);
// Set other employee properties emp.m_empNo = empNo; emp.m_salary = salary;
ok = true; } } }
return ok; }
// Implementation of the 0 arg load function bool load() { bool ok = true;
// Open the file if (File::openFile("data_file_name")) { // Get the number of records noOfEmployees = File::noOfRecords();
// Allocate memory for employees employees = new Employee[noOfEmployees];
// Load data into employees for (int i = 0; i
// Close the file File::closeFile(); } else { cerr
return ok; }
// Implementation of display function void display(const Employee& emp) { cout
// Implementation of the display function void display() { cout
// Implementation of deallocateMemory function void deallocateMemory() { for (int i = 0; i # PART 1 (50%%) Employees Salary Report ***Employees Salary Report*** is a program that reads an unknown number of Employee records from a file and holds these records of Employees in a dynamically allocated array of **Employee**s. (Each record holds the Employee's , Employee number and Salary of the Employee in a comma-separated value format. ) After loading all the information into a dynamic array of **Employee**s, the program will sort the records based on the Employee number of the Employee in ascending order and prints them on the screen. ## PART 1 Execution example ""text Employee Salary report, sorted by employee number no- Empno, Name, Salary 117493: Bumblebee Man, $43554 238023: Alice Glick, $15310 3- 261382: Artie Ziff, $44801 4- 268411: Bernice Hibbert, $27776 463877: Allison Taylor, $93971 6- 529967: Abraham Simpson, $80084 7- 543817: Barney Gumble, $54858 8- 737371: Agnes Skinner, $32943 9- 760089: Akira Kurosawa, $55772 10- 811518: Baby Gerald, $90670 11- 836915: Apu Nahasapeemapetilon, $63415 12- 881837: Bart Simpson, $47608 13- 928072: Carl Carlson, $23678 14- 954291: Brandine Spuckler, $51499 This program is partially developed; you can find all the files in the lab directory. Your responsibility is to complete the code as stated in the workshop. ## The Code The structure holding the Employee record is designed as follows: - " " C++ struct Employee { char* m_name; int m_empNo; int m_salary; In addition to holding the employee records in a dynamically allocated array of "Employee's, each employee's name is also held in a dynamically allocated C-style string in the **Employee** structure. Consider the following visual and note that every circle with an arrow in this diagram shows dynamic memory in use. ! [DMA ] (images/mem.## Data file The data in the file has the following format: " ~ ~ Text EMPLOYEE NUMBER, SALARY, NAME
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started