This tutorial will teach you to calculating the employee salary.Input the employee name and the basic salary calculate and display the netsalary using following condition.
if the basic salary is more than 50000 then include 10% tax.
if the basic salary is more than 30000 then include 5% tax.
otherwise no tax.
paste the code inside the ok button
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { double salary,tax,netsal; salary = Double.parseDouble(txtsal.getText()); if(salary > 50000) { tax = salary * 10/100; } else if(salary > 35000) { tax = salary * 5/100; } else { tax = 0; } txttax.setText(String.valueOf(tax)); netsal = salary - tax; txtnetsal.setText(String.valueOf(netsal)); } |
paste the code inside the Clear button
1 2 3 4 | txtsal.setText(""); txttax.setText(""); txtnetsal.setText(""); txtsal.requestFocus(); |
paste the code inside the Exit button
1 | System.exit(0); |
i have attached the video link below. which will do this tutorials step by step.