We were required to do servlet handling where we needed to compute for the net pay salary of an employee with the inputs given by the user. I managed to get the info right but when it came to getting the rate the output shows 0 instead of the assigned hourly rate that depends on what the position the user inputs. Here's the block of code I have so far: {
private int rate;
private int grosspay;
private int sss;
private double philhealth;
private double pagibig;
private double tax;
private double deductions;
private int bonus;
private double netpay;
public ComputeBean()
{}
public void setEmployeeid(int employeeid)
{
this.employeeid = employeeid;
}
public int getEmployeeid()
{
return employeeid;
}
public void setEmployeename(String employeename)
{
this.employeename = employeename;
}
public String getEmployeename()
{
return employeename;
}
public void setDepartment(String department)
{
this.department = department;
}
public String getDepartment()
{
return department;
}
public void setHour(int hour)
{
this.hour = hour;
}
public int getHour()
{
return hour;
}
public void setCategory(String category)
{
this.category = category;
}
public String getCategory()
{
return category;
}
public void setPosition(String position)
{
this.position = position;
}
public String getPosition()
{
return position;
}
private void setRate(int rate)
{}
public void computeRate(int rate)
{
getPosition();
if(position.equals("clerk"))
{
setRate(rate = 100);
}
else if(position.equals("sup"))
{
setRate(rate = 200);
}
else if(position.equals("mana"))
{
setRate(rate = 300);
}
else if(position.equals("exec"))
{
setRate(rate = 500);
}
}
public int getRate()
{
return rate;
}
} }