In C++. This is long so I will post in 2 questions. I dont understand pointers t
ID: 3835321 • Letter: I
Question
In C++. This is long so I will post in 2 questions. I dont understand pointers thats why im posting this. Do the employee class and i will post rest of the menu part of the question in another post. Or if you want do the whole thing, up to you. Thank you
Class – Employee
Data Type
Contains the employee’s first name. This variable should be a pointer.
Contains the employee’s last name.
Contains the number of hours the employee worked. This variable should be a pointer.
Contains the hourly rate of pay for regular hours worked (not overtime).
Contains the hourly rate of pay for overtime hours (hours worked over 40). This variable should be a pointer.
Member Function Signatures and Descriptions (all public)
Copy constructor
Allocates member variables as necessary and sets the values of each member variable to the values of the passed in object. ( This method is a deep copy)
Performs cleanup of dynamically allocated member variables.
operator=
MEMBER OVERLOAD
Overload the assignment operator so that it performs a deep copy. Should assign one instance of Employee to another.
NON-MEMBER OVERLOAD
Returns true if the left side has a higher overall gross pay than the right side.
Hint: There is a function named GrossPay that you can use inside this overload.
NON-MEMBER OVERLOAD
Reads all data from the istream. Assume the istream is open and read to use. See below for the layout of the file. (no values from user in this function)
NON-MEMBER OVERLOAD
Writes all data into the given ostream. Assume the ostream is open and ready to use. You must write the data according to the file format given below.
Console Application
Main Function Specifications
Create a DYNAMIC array of Employee. The program should populate the array with data from an input file.
This function should show a menu to the user (description below) and take an action depending on what the user chooses to do.
Required Variables - Declare one instance of a DYNAMIC array of Employee inside main. You may also need other variables. Make sure there are no memory leaks caused by the allocation of the dynamic array.
Main Menu Loop - This program should show a menu to the user and take an action depending on what the user chooses to do. Here is the menu:
Employee Program
1 - Read employee array from file
2 - Write employee array to file
3 - Show all employee array data on screen
4 - Show highest employee gross pay
5 - Exit
Menu Description
Choice #
Read employee data from file
Fill the DYNAMIC employee array with data from a user-specified file. You should ask the user to enter a filename and then read the data from the file that the user specified. The file format is described below in the section Employee Array Input File Format.
The employee array should be allocated to the correct size to hold all employee data. You CANNOT assume that the same number of employees will be read in each time this menu option is chosen. The number of employees is the first piece of data in the file (see below - Employee Array Input File Format).
You MUST use the >> operator overload to read in each element of the array. If you do not use the >>operator overload you will receive no credit for this part.
Hint: You need to deallocate the array if necessary then reallocated a new array of the correct size.
Write employee info to a file
Writes all Employee instance member variable data from the employee array to a file. You should ask the user to enter a filename and then write all the member variable data to the user specified file.
You MUST use the << operator overload to write each element of the array. If you do not use the << operator overload you will receive no credit for this part.
Hint: Make sure you write the count of the number of employees to the file first.
Show all employee data on screen
You do not need to show descriptive text. Just show the data on screen.
You MUST use the << operator overload to show each element of the array. If you do not use the << operator overload you will receive no credit for this part.
Show highest salary employee
Show all information for the employee with the highest gross pay.
The code for this menu option MUST use both the > and = overloads or you will receive no credit for this part.
Hint: Need a local Employee variable that can be used to store the highest salary employee. As you go through the array if the current element in the array is greater than (>) the local Employee’s salary then then the current element should be assigned (=) to the local variable.
Exit the program.
Single Employee Input Format
FirstName
LastName
HoursWorked
RegularHourlyRate
OvertimeHourlyRate
Single Employee Sample Input Data (notice there is no descriptive text, just the data)
Derek
Jeter
40
200.00
Employee Array Input File Format
EmployeeCount
FirstName
LastName
HoursWorked
RegularHourlyRate
OvertimeHourlyRate
FirstName
LastName
HoursWorked
RegualrHourlyRate
OverTimeHourlyRate
...
FirstName
LastName
HoursWorked
RegualrHourlyRate
OverTimeHourlyRate
Sample Employee ArrayData (notice there is no descriptive text, just the data)
Derek
Jeter
40
200.00
VariableData Type
Description FirstName string*Contains the employee’s first name. This variable should be a pointer.
LastName stringContains the employee’s last name.
HoursWorked double*Contains the number of hours the employee worked. This variable should be a pointer.
RegHourlyRate doubleContains the hourly rate of pay for regular hours worked (not overtime).
OverTimeHourlyRate double*Contains the hourly rate of pay for overtime hours (hours worked over 40). This variable should be a pointer.