#include #include #include using namespace std; //Specimen Paper B2 Lab Period Tuesday24 Feb 2009 //================== /* The employee file Employee.dat consist of ( employee id A99999, N=calariedame 20(A), Tel 7(9), type H=hourly S=salaried) Additional data is required for each employee. For 'salaried worker', the salary is to be entered. For 'hourly worker', the "hourly rate" and "hours worked per week" need to be entered. a) Identify suitable classes that can store the above information. b) Write a code that will read a record from EMPLOYEE.DAT display the record read, and user to enter the additional data. The updated record containg the original fields plus payment field is to be stored in the file UEMPLOYEE.DAT The Format of Employee.dat is -------------- -------------- and UEMPLOYEE.DAT is ============================== ============================== For 'salaried' worker the Hourly rate and hours worked should be 0. What about for 'hourly worker'? submit to tpjc_sg@yahoo.com */ class Employee{ private: public: }; class SalariedEmployee : public Employee { }; class HourlyEmployee : public Employee { }; void main(){ Employee x; SalariedEmployee y; HourlyEmployee z; // alogrithm // open input file EMPLOYEE.DAT // open output file UEMPLOYEE.DAT // read DEPARTMENT and No_Rec from inputfile // write DEPARTMENT and No_Rec to output file // Loop No_Rec times // read an Employee record x // Display Employee record // Get the type of Employee from x e.g. empType = x.getType() // if empType=='H' { // enter hourly payment and hourlyrate of HourlyEmployee z e.g. z.enter() // copy detail of employee x to HourlyEmpoyee z // save z in the output file // else // enter salary fo SalariedEmployee y e.g y.Enter() // copy detail of employee x to Salaried Employee z // save y to output file // close input file // close output file }