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 #include "Employee.h" #include "File.h" #include #include using namespace std; namespace sdds {

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

Need help fixing this code. keeps sayingSeverity Code Description Project File LineSuppression State Error C2653 'File': is not a class or namespace nameOOP244 C:\Users\balit\OneDrive\Desktop\OOP244\ws02\WS02\OOP244\Employee.cpp 47and Severity Code Description Project File Line Suppression State WarningC6054 String 'tempName' might not be zero-terminated. OOP244 C:\Users\balit\OneDrive\Desktop\OOP244\ws02\WS02\OOP244\File.cpp 43 this isthe code #include #include "Employee.h" #include "File.h" #include #include using namespace std;
# 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 and this is a sample file: Text 529967, 80084. 0, Abraham Simpson 737371, 32943.0, Agnes Skinner 760089, 55772.0, Akira Kurosawa 238023, 15310.0, Alice Glick 463877, 93971.0, Allison Taylor 836915, 63415.0, Apu Nahasapeemapetilon 261382, 44801.0, Artie Ziff 811518, 90670.0, Baby Gerald 543817, 54858.0, Barney Gumble 881837, 47608.0, Bart Simpson 268411, 27776.0, Bernice Hibbert 954291, 51499.0, Brandine Spuckler 117493, 43554.0, Bumblebee Man 928072, 23678.0, Carl Carlson ### The Modules There are three modules in the program: "File" , "Employee" and " main" . #### *File" Module This modules contains functions that facilitate working with files to read data. The module has one global variable called `fptr' . This File pointer is used to point to the datafile for the application. The following functions are already implemented in the "File" module: openFile : Opens the data file for reading closeFile : Closes the data file "noOfRecords" : Returns an integer that is the number of records in the file; use this function in the " Employee" module to determine the size of the dynamic array of employees. ***Your coding responsibility in the *File module:**>Implement 3 **overloads** of a Function called \"read\": 1. \"read\" function: as a parameter, this function accepts a reference of character pointer. (\"char*& name\"); this reference will be used to set the dynamic name of the employee to the name stored in the file. To accomplish this, in a local array of 128 characters read (fscanf) from the file the name of the employee (up to 127 characters). Then if the scan was successful (if fscanf returned 1) set the reference parameter of the function to a dynamic memory equal to the length of the scanned name (+1) and copy the name into it. Returns \"true\" if the read was successful, \"false\" otherwise. Use the following \"fscanf\" function to read the name of the employee (up to the newline and skipping it) from file. See more information [here](https:f/en.cppreference.comfw/cppfio/c/fscanf). \"\"\"C fscanfffile_pointer, \"%127[\"\ ]\ \" ...... 2. \"read\": accepts as a parameter, a *Ereference33 to an integer representing the employee number. Reads from the file the employee number and stores it in the parameter. Returns \"true\" if the read was successful, \"false\" otherwise. Use the following \"fscanf\" function to read the number from the file (skipping the comma) and return true if \"fscanf\" returns 1. See more information [here](https:ffen.cppreference.comfwicpp/ioic/fscanf). \"\"\"C fscanf{fptr, \"%d,\" ....... 3. \"read\": accepts as a parameter, a *areference** to a double precision number representing the employee's salary. Reads from the file the employee salary and stores it in the parameter. Returns \"true\" if the read was successful, \"false\" otherwise. Use the following \"fscanf\" function to read the salary from the file (skipping the comma) and return true if \"fscanf\" returns 1. See more information [here](https:ffen.cppreference.comfwfcpp/iofcffscanf]. \"\"\"C fscanf(fptr, \"%lf,\" #### \"Employee\" Module The \"Employee\" module has two global variables: CPP ff Holds the number of records (employees) in the file. [I Should be used (after setting) to allocate the dynamic array of Employees. int noOfEmployees; ff Holds the address of the dynamicallyallocated array of employees. if The size of the array is \"noOfEmployees\". EmployeeEC employees; The function \"sort\" has been already implemented. This function sorts the array of employees based on the employee number. 38*Your coding responsibility in the \"Employee\" module.*** Implement Following Functions: \"load\": receives as a parameter, a reference to an object of type \"Employee\NUMBER: NME, $SALARY - see [sample output](#part-l-execution-example) For more details. 'deallocateMemory': deallocate - all: the memory used by the the dynamic array of employees (make sure to First deallocate the names and then the array). 1. Goes through the dynamic array oF \"Employee's and deletes all the names oF the Employees. 2. Deletes the dynamic array of 'Employee's. ### The Salary Report (the \"main\" Module) This module is already provided. Look at it, make sure you understand it, and do not change it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!