Hospital - import import import import import import...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Scanner; import java.util.StringTokenizer; import java.io.PrintWriter; public class Hospital { public final static int maxEmployees = 100; private double currentPayroll; Employable[] employees; private int numEmployees; public Hospital() { currentPayroll = 0; employees = new Employable[0]; } public Hospital(File file) { try { loadHospital(file); } catch(FileNotFoundException fnfe) { employees = new Employable[0]; currentPayroll = 0; } catch(NullPointerException npe) { employees = new Employable[0]; currentPayroll = 0; } } public Hospital(Employable[] employees) { if (employees != null) { setEmployees(employees); } } public double getCurrentPayroll() { return currentPayroll; } public Employable[] getEmployees() { return employees; } public int getNumEmployees() { return numEmployees;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
} public void setCurrentPayroll(double currentPayroll) { this.currentPayroll = currentPayroll; } public void setEmployees(Employable[] employees) { numEmployees = 0; currentPayroll = 0; this.employees = new Employable[maxEmployees]; if( employees != null ) { for(int i=0; i<employees.length; i++) { if(numEmployees==maxEmployees){ break; } else{ if(employees[i]!=null){ if( employees[i] instanceof Nurse ) currentPayroll += ((Nurse)employees[i]).getSalary(); else currentPayroll += ((Doctor)employees[i]).getSalary(); this.employees[numEmployees++] = employees[i]; } } } } } public boolean hire(Employable employee) throws NullPointerException
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/25/2010 for the course CIS CIS3023 taught by Professor Seema during the Spring '10 term at Florida College.

Page1 / 6

Hospital - import import import import import import...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online