Java Reference
In-Depth Information
Results of the Tutorial
Let's examine the results of the tutorial:
1.
In Tutorials, a new package called c7 with 11 classes, two of which are the new classes
LoopTestApp, and DateTimeApp.
2.
Printouts of the LoopTestApp and DateTimeApp source code.
3.
The EnterEmpInfo frame should have a choice for exemptions that displays the values zero
through ten using a loop.
4.
EnterEmpInfo should check that the pay rate value is numeric.
5.
Employee's setPayRate method should verify that a pay rate value is between $6.50
and $35.00.
6.
EnterEmpInfo's actionPerformed method should look like the following:
public void actionPerformed(ActionEvent e) {
resultLbl.setForeground(Color.black);
this .setEmployeeProperties();
if (inputError == false ) {
if (dispBtn == e.getSource()) {
EmployeeFrame ef = new EmployeeFrame(emp);
} else {
if (grossBtn == e.getSource()) {
resultLbl.setText("Gross Salary is: " +
emp.grossSalaryCalcFormatted());
} else {
if (taxBtn == e.getSource()) {
resultLbl.setText(
"The Federal Tax amount is: " +
emp.fedTaxCalcFormatted());
}
}
}
}
else {
inputError = false ;
}
}
7.
EnterEmpInfo's setEmployeeProperties method should look like the following:
private void setEmployeeProperties() {
emp.setEmpName(empNameTF.getText());
emp.setEmpStreet(empStreetTF.getText());
emp.setEmpCity(cityTF.getText());
emp.setEmpState(stateTF.getText());
emp.setEmpZip(zipTF.getText());
try {
emp.setPayRate(Double.parseDouble(empPRTF.getText()));
emp.setExemptions(Integer.parseInt(exmpChoice.getSelectedItem()));
}
Search WWH ::




Custom Search