Calculate code
private void jButton5ActionPerformed (java.awt.event. ActionEvent evt) {
int HourlyRate=4;
double bonusel=0.10;
double SalaryBased = 0;
int salary-5;
double Bonuse=0;
double RevisedSalary-0;
//In the code above, the data that is calculated in the Java program is defined and the information shown in the Jframe.
try{ String host= “C:\Users\user\Documents\NetBeansProjects\JavaApplication1";
String un="Amna";
String pwd="l23";
Connection con =Driverkanager.getConnection(bost, un, pud);
Statement stat = con.createStatement ();
String name=jt2.getText () ;
String sql; sql= "SELECT EEMPLOYEEID, EMPLOYYENAME, DAY, HOURSWORK FROM AMAN. UNTITLED WHERE EMPLOYITENANE=" ResultSet 1s =stmt.executeQuery(sql);
The upper part notes that in addition to code, the server will be connected to the software through the host and indeed the username. The coding above though includes the names of the sections in the server, where the scan may take place here by the worker's name, where his details will appear each week and the amount of hours worked.double SumHours,total=0;
int i-0;
while (rs.next ()) {{ int HOURSWORK = rs.getInt ("HOURSWORK");
total=total+HOURSWORK; i++;} SumHours=total+i;
jt5.setText (Double.toString(SumHours));
In the code below, via the search process, the number of working hours displayed to a person in the database is determined and displayed in iframe.SalaryBased=HourlyRate*salary*5;
jt6.setText (Double.toString(SalaryBased) ) ;
From the above code, the employee's basic salary is determined by entering the number of actual hours he operates in each day, and multiplying by the number of days and an hour's price.if(total>=30) Bonuse=SalaryBased*bonusel;
else if(total>=25) { Bonuse=SalaryBased*bonuse2;
else{ Bonuse=SalaryBased*bonuse3;
jt7.setText (Double.toString(Bonuse));
In the code above, the rate of reward is calculated by the number of working hours that the employee works through the above code in the case of a person working for 30 years. And less than that is not given any reward.
RevisedSalary=SalaryBased+Bonuse;
jt8.setText (Double. toString(RevisedSalary));
rs.close ();
stmt.close ();
con.close (); } catch (SQLException ex) { System.out.println (ex.getMessage ());
In the above code, the final salary is calculated with the bonus if he is working in overtime.