
write a java program in to create a class Worker and derive classes DailyWorker and SalariedWorkerstrong text frim it . every worker has a name and a salaryrate.
write method Company strong text (int hours) to compute the week pay of every worker. a Daily worker ia paid on the basis of the number of days s/he works. the salaried worker gets paid the wage for 40 hours a week no matter what the actual hours are. Test this program to calculate the pay of workers. you are expected to use the concept of polymorphism to write this program.

class Worker{
String name;
int empno;
Worker(int no,String n){
empno=no; name=n;
}
void show(){
System.out.println("Employee number : "+empno);
System.out.println("Employee name: "+name);
}
}
class DailyWorker extends Worker{
int rate;
DailyWorker(int no,String n,int r){
super(no,n);
rate=r;
}
void company(int h){
show();
System.out.println("Salary : "+(rate*h));
}
}
class SalariedWorker extends Worker{
int rate;
SalariedWorker(int no,String n,int r){
super(no,n);
rate=r;
}
int hour=40;
void company(){
show();
System.out.println("Salary : "+(rate*hour));
}
}
class TestWorker{
public static void main(String args[]){
DailyWorker d=new DailyWorker(11,"A",75);
SalariedWorker s=new SalariedWorker(22,"B",100);
d.company(45);
s.company();
}
}