Java NetBeans GUI application to calculate salary of employee.

Q6. Design a Java NetBeans GUI application to calculate salary of employee.

Sol:

Create a GUI application as per following screenshot.

Type the following code by double clicking BtnCal, button, below the line that says, ‘// TODO add your handling code here’

 

double sal,da,ta,hra,cca;

sal=Double.parseDouble(txtsal.getText());

da=sal*.15;

lblda.setText(da+” “);

ta=sal*.25;

lblta.setText(ta+” “);

hra=sal*.35;

lblhra.setText(hra+” “);

cca=sal*.30;

lblcca.setText(cca+” “);

}

 

Type the following code by double clicking BtnClear, button, below the line that says, ‘// TODO add your handling code here’

 

txtname.setText(“”);

txtsal.setText(“”);

lblda.setText(“”);

lblhra.setText(“”);

lblta.setText(“”);

lblcca.setText(“”);

}

OUTPUT:

on click of BtnCal Button

on Click of BtnClear Button

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: