public void print (Worker[] wor)
{
for (int i=0;i<wor.length;i++)
{
if(wor[i].id<=9)
System.out.print(wor[i].id+" ");
else if(wor[i].id<=99)
System.out.print(wor[i].id+" ");
else System.out.print(wor[i].id+" ");
if(wor[i].name.length()==1)
System.out.print(wor[i].name+" ");
else if(wor[i].name.length()==2)
System.out.print(wor[i].name+" ");
else if (wor[i].name.length()==3)
System.out.print(wor[i].name+" ");
else if (wor[i].name.length()==4)
System.out.print(wor[i].name+" ");
else if (wor[i].name.length()==5)
System.out.print(wor[i].name+" ");
else if (wor[i].name.length()==6)
System.out.print(wor[i].name+" ");
else System.out.print(wor[i].name+" ");
if(wor[i].entryYear.length()<=9)
System.out.print(wor[i].entryYear+" ");
else if(wor[i].entryYear.length()<=99)
System.out.print(wor[i].entryYear+" ");
else System.out.print(wor[i].entryYear+" ");
if(wor[i].calcSalary()<=9)
System.out.print(wor[i].calcSalary()+" ");
else if(wor[i].calcSalary()<=99)
System.out.print(wor[i].calcSalary()+" ");
else System.out.print(wor[i].calcSalary()+" "+"\n");
}
}
}
public Manager(int id,String name,String entryYear,double salary,double commission)
{
super(id,name,entryYear,salary);
this.commission=commission;
}
public double calcSalary()
{
return super.salary+((commission/100)*super.salary);
}
public void print (Manager[] mgr)
{
for (int i=0;i<mgr.length;i++)
{
if(mgr[i].id<=9)
System.out.print(mgr[i].id+" ");
else if(mgr[i].id<=99)
System.out.print(mgr[i].id+" ");
else System.out.print(mgr[i].id+" ");
if(mgr[i].name.length()==1)
System.out.print(mgr[i].name+" ");
else if(mgr[i].name.length()==2)
System.out.print(mgr[i].name+" ");
else if (mgr[i].name.length()==3)
System.out.print(mgr[i].name+" ");
else if (mgr[i].name.length()==4)
System.out.print(mgr[i].name+" ");
else if (mgr[i].name.length()==5)
System.out.print(mgr[i].name+" ");
else if (mgr[i].name.length()==6)
System.out.print(mgr[i].name+" ");
else System.out.print(mgr[i].name+" ");
if(mgr[i].entryYear.length()<=9)
System.out.print(mgr[i].entryYear+" ");
else if(mgr[i].entryYear.length()<=99)
System.out.print(mgr[i].entryYear+" ");
else System.out.print(mgr[i].entryYear+" ");
if(mgr[i].calcSalary()<=9)
System.out.print(mgr[i].calcSalary()+" ");
else if(mgr[i].calcSalary()<=99)
System.out.print(mgr[i].calcSalary()+" ");
else System.out.print(mgr[i].calcSalary()+" ");
}
}