privatevoidbtCalcularActionPerformed(java.awt.event.ActionEventevt){doublesalario=0,irrf=0,inss=0,valorTotal=0;FolhaPagamentopagamento=newFolhaPagamento(Double.parseDouble(txtValorSalario.getText()));salario=pagamento.getSalario();if(cbIRRF.isSelected()){irrf=salario*0.17;txtIRRF.setText(String.valueOf(irrf));}elsetxtIRRF.setText("");
if(cbINSS.isSelected()){
inss = salario * 0.05;
txtINSS.setText(String.valueOf(inss));
}
else txtINSS.setText("");
valorTotal = salario + irrf + inss;
txtValorTotal.setText(String.valueOf(valorTotal));
}
The user types a numeric value of the employee's salary and can click the checkboxes ( JCheckBox
) for the incident contributions. If the IRRF box is checked, the corresponding Withholding Income Tax value, that is, 17% of the salary value, should appear. In the same way, if the INSS box is checked, the corresponding INSS value (5%) should appear.