Recruitment paper question
Hi all,
This was a question in of the written exams conducted by a well known software firm at our college. I just could'nt do it. Please try to solve and post the solution...
A company consists of employees and their bosses.Each employee reports to one boss and each boss may have a no. of employees working under him. The cost to the compnay of an employee is his salary plus the salary of people working under him ,if he is a boss.In case he is not a boss to any other employee then his cost to the company is just his salary.
The following class is given:
Code:
Class employee
{
name
isboss;
bossname;
salary;
getsalary();
}
Write a function float costothecompany(char *name) that accepts employee name as input and returns his costtothecompany as output.Make neceesary assumptions.
Maybe im not making some necessery assumptions, thats why im not able to solve the problem.