PROgramming TAsk

#include<iostream>
#include<string>
using namespace std;
class Employee{
string fname,lname;
public:
Employee(){
}
Employee(string n,string n1){
fname=n;
lname=n1;
}
void Display(){
cout<<" *<< Employee Detaile >>* "<<endl;
cout<<" Full Name: "<<fname<<" "<<lname<<endl;
}
};
class Hourlyworker:public Employee{
double wage,hour,salary;
public:
Hourlyworker():Employee("ZAIN","SHAHID"){
wage=25500.0;
hour=12.0;
}
float getpay(){
salary=wage*hour;
return salary;
}
void show(){
cout<<" Salary of Employee is: "<<salary;
}
};
int main(){
Hourlyworker hw;
hw.Display();
hw.getpay();
hw.show();
}

No comments:

Post a Comment