FileDocCategorySizeDatePackage
Hospital.javaAPI DocExample1254Sun Oct 28 12:02:26 GMT 2001hospital.myprojects

Hospital.java

package hospital.myprojects;

import java.awt.*;
import java.awt.event.*;

class Hospital extends Frame {
	private Patient p1 = new Patient();
	private Patient p2 = new Patient();
	private Patient p3 = new Patient();
	private Ward w1    = new Ward();
	
	public Hospital() {
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				dispose();
				System.exit(0);
			}
		});
		String returnMessage;
		p1.setPatientDetails("June Smith", 66 , "AB1234D");
		p2.setPatientDetails("Fred Bloggs",75 , "wm123456c");
		p3.setPatientDetails("Hilary Hobbs",80, "bb876543d");
		// Set up a ward with 10 beds, named Otter, and add 3 patients
		w1.setWardDetails(10 , "Otter");
		// addPatient method returns a String type message, so print it out...
		returnMessage = w1.addPatient(p1);
		System.out.println(returnMessage);
		returnMessage = w1.addPatient(p2);
		System.out.println(returnMessage);
		returnMessage = w1.addPatient(p3);
		System.out.println(returnMessage);
		
		
		// Display the details of the ward
		w1.displayWardDetails();
	}
	public static void main(String args[]) {
		System.out.println("Starting Hospital with Arrays...");
		Hospital mainFrame = new Hospital();
	
	}
}