Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save viveknarang/c5f628fbfe6e99d919251038b679622c to your computer and use it in GitHub Desktop.
Save viveknarang/c5f628fbfe6e99d919251038b679622c to your computer and use it in GitHub Desktop.
public void printEmpData(int id)
{
boolean exists = false;
System.out.println("ID" + " " + "Name" + " " + "Hours" + " " + "Salary");
System.out.println("-------------------------");
for(int i = 0; i < employeePayroll.length; i++) {
if (employeePayroll[i].getId() == id) {
exists = true;
System.out.println(employeePayroll[i].getId() + " " + employeePayroll[i].getName() + " " + employeePayroll[i].getHours() + " " + (employeePayroll[i].getHours() * employeePayroll[i].getRate()));
}
}
if (!exists) {
System.out.println("The employee payroll information does not exist.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment