Java Reference
In-Depth Information
12.
On the Employee Information frame, click the Window Close button.
13.
On the Enter Employee Information frame, click the Gross button.
The message “Gross salary is: $430.00” will be displayed.
14.
On the Enter Employee Information frame, click the TaxAmt button.
The message “The Federal Tax amount is: $36.00” will be displayed. Congratulations, you have created a
full-fledged Java application!
The EnterEmpInfo actionPerformed method should look similar to the following:
public void actionPerformed(ActionEvent e) {
String empPayRate = empPRTF.getText();
double doubleEmpPR, doubleGross;
doubleEmpPR = Double.parseDouble(empPayRate);
if (dispBtn == e.getSource()){
Employee emp =
new Employee(empNameTF.getText(),
empStreetTF.getText(),
cityTF.getText(),
stateTF.getText(),
zipTF.getText());
EmployeeFrame ef = new EmployeeFrame(emp);
}
else {
this .add(resultLbl);
if (grossBtn == e.getSource()){
doubleGross = doubleEmpPR * 40;
resultLbl.setText("Gross Salary is: $" +
doubleGross + "0");
}
else {
if (taxBtn == e.getSource()){
Employee emp =
new Employee("","","","","");
String exmp = exmpTF.getText();
int intExmp = Integer.parseInt(exmp);
double doubleTaxAmt =
emp.fedTaxCalc(doubleEmpPR, intExmp);
resultLbl.setText("The Federal Tax amount
is: $" + doubleTaxAmt + "0");
}
}
}
// System.out.println(empPayRate);
}
 
Search WWH ::




Custom Search