For a recent project, I was tasked with implementing servlet handling to calculate the net pay salary of an employee based on user input. While most of the information was processing correctly, I encountered an issue when attempting to determine the rate. Instead of displaying the assigned hourly rate based on the user's input for position, the output was showing as 0. Below is a snippet of the code I have been working on: {
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;
}
} }