Inheritance-1

Write a base class named Employee and derive classes Male employee and Female Employee from it. Every employee has an id, name and a scale of salary. Make a function ComputePay(in hours) to compute the weekly payment of every employee. A male employee is paid on the number of days and hours he works. The female employee gets paid the wages for 40 hours a week, no matter what the actual hours are. Test this program to calculate the pay of employee.




#include<iostream>

using namespace std;

class employee
{int id;
char name[10];
int salary;
public:
     int retrunid()
     {
           return(id);
     }
     char *returnname()
     {
            return(name);
     }
     int returnsalary()
     {
           return(salary);
     }
     void setdata()
     {
           cout<<"\n Enter id, name and salary per hour";
           cin>>id>>name>>salary;
     }
};
class male:public employee
{public:
void computepay()
{
     int day,hr;
     cout<<"\n Enter number of days and hours of works";
     cin>>day>>hr;
     int monthlysalary=day*hr*returnsalary();

     cout<<"\n The employee"<<returnname() << " has id is "<<retrunid();
     cout<<"\n Montly salary is "<< monthlysalary;
}
};
class female:public employee
{
public:
void computepay()
{
    
     int monthlysalary=40*returnsalary();
     cout<<"\n The employee"<<returnname() << " has id is "<<retrunid();

     cout<<"\n Montly salary is "<< monthlysalary;
}
};
void main()
{
     male m1;
     m1.setdata();
     m1.computepay();
     female f1;
     f1.setdata();
     f1.computepay();

}