FileDocCategorySizeDatePackage
InPatient.javaAPI DocExample1157Sun Oct 28 10:49:52 GMT 2001None

InPatient.java



import java.awt.*;


public class InPatient extends Patient {
	// The InPatient class adds two more items of data, numberDaysResident
	// and the wardName...
	private int numberDaysResident;
	private String wardName;
	
	public void setInPatientDetails(String name, int pulse, String ID, int numberDaysResident,
	                                String wardName) {
		// Some of this data belongs to the the superclass 'PatientClass', so we
		// can use a public method of that superclass to set it.
		setPatientDetails(name , pulse , ID);
		// copy over the last two parameters.
		this.numberDaysResident = numberDaysResident;
		this.wardName = wardName;
	}
	
	public void displayInPatientDetails(Graphics g, int x, int y) {
		//Call the super-class method to display some of the data
		displayPatientDetails(g,x,y);
		// display the rest
		g.drawString("Number of Days Resident = " + numberDaysResident, x, y + 60);
		g.drawString("Ward = " + wardName, x, y + 80);
	}
	
	public void incrementDaysResident() {
		numberDaysResident++;
	}
	
	public int getNumberDaysResident() {
		return numberDaysResident;
	}
	
	
}