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
Step: 1
dateh ifndef DateH define DateH class Date public void setDateint d int ...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