FileDocCategorySizeDatePackage
Ward.javaAPI DocExample1546Sun Oct 28 21:05:46 GMT 2001hospital.myprojects

Ward.java

package hospital.myprojects;

public class Ward {
	// A simplified version' of a Ward class
	// to illustrate the linkage between wards and a single patient.
	// Later, this will be expanded to have a realistic number of patients.
	private int numberBeds;
	final private int maxNumberBeds=20;
	private String wardName;
	private int numberBedsOccupied=0;
	private Patient patient[]=new Patient[maxNumberBeds];
	
	public void setWardDetails(int numberBeds, String wardName) {
		this.numberBeds = numberBeds;
		this.wardName = wardName;
	}
	public void displayWardDetails() {
		System.out.println("Displaying ward details");
		System.out.println("Ward name: " + wardName);
		System.out.println("Number of beds: " + numberBeds);
		int iloop;
		for(iloop = 0; iloop < numberBedsOccupied; iloop++) {
			System.out.println("Patient's name = " + patient[iloop].getName());
		    System.out.println("Patient's ID = " + patient[iloop].getID());
		    System.out.println("Patients last pulse = " + patient[iloop].getPulse());
		}
		System.out.println("array size is "+patient.length);
	}
	public String addPatient(Patient patient) {
		if(numberBedsOccupied < numberBeds) {
			this.patient[numberBedsOccupied] = patient;
			numberBedsOccupied++;
			return "Patient successfully added to ward";
		} else {
			return "Ward full";
		}
	}
		
	/*public Patient getPatient() {
		return patient;
	}
	public int getNumberBeds() {
		return numberBeds;
	}
	public String getWardName() {
		return wardName;
	}*/
}