Thursday, July 30, 2009

Write a C++ program that creates a class named Employee.?

It should be having the following data members





•Name//for employee name


•Experience// for employee’s experience in a particular organization





Class Employee should overload two operators; %26lt; and %26gt;


These operators should be used to find out the seniority of two employees (two employee class objects should be declared in main). After comparison it will display the employee name whose seniority is higher than the other's.


An employee has higher seniority if his/her experience is more than the other employee.


If the two employees has same experience, the name of both the employees should be displayed.

Write a C++ program that creates a class named Employee.?
it's been a while so my code will be rusty! also not compiled. but this is homework anyway, right? so you will learn some tricks by debugging my code. :)





class Employee


{


char Name[];


int Experience;





public:


Employee operator%26lt;(const Employee%26amp; a, const Employee%26amp; b) char *;


Employee operator%26gt;(const Employee%26amp; a, const Employee%26amp; b) cahr *;};





// define constructor


Employee::Employee operator%26lt;( Employee a, Employee b )


{


if (a.Experience %26lt; b. Experience) {


return a.Name;


}


}





or something like that! :)


No comments:

Post a Comment