Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Numerical Analysis

Authors: Richard L. Burden, J. Douglas Faires

9th edition

538733519, 978-1133169338, 1133169333, 978-0538733519

More Books

Students also viewed these Programming questions

Question

Justify the formula lim n | (x

Answered: 1 week ago