Question: Consider the following classes. class Date { private: int day, month, year; public: Date(int d, int m, int y) { day = d; month =
Consider the following classes.
class Date
{ private:
int day, month, year;
public:
Date(int d, int m, int y) { day = d; month = m; year = y; }
};
class Employee
{ private:
int ID;
int salary;
Date dob;
Date joiningDate;
public:
void writeToDisk(string fileName){}
void readFromDisk(string fileName, int recordNumber) { }
static int countRecords(string fileName) {}
};
• Complete the given functions in the Employee class. Use the function writeDisk()
to write data of few employees in a file “emp.dat”.
• Overload “<<” and “>>” operators for the Employee class.
• Write a stand-alone function void searchEmp(int ID) which accepts ID of an
employee as input, searches for the employee in the file and prints all data of the
searched employee.
• Write a stand-alone function to print data of all employees (stored in the file), who
joined the organization after the year 2015.
• Write a stand-alone function to read data from the file, increase the salary of all
employees by 10% and write them back to the file.
Step by Step Solution
3.43 Rating (150 Votes )
There are 3 Steps involved in it
To tackle the tasks given in your question well address them stepbystep focusing on implementing the required functionalities for the Employee class a... View full answer
Get step-by-step solutions from verified subject matter experts
