DataField{
	Units un;
	HeightField(String s, int n, DataEntry d, Units u){
		super(s,n,d);
		un=u;
	}
	public String currValueOfUS(String s){
		return un.USToCurrLength(s);
	}
	public String USValueOfCurrent(String s){
		return un.CurrToUSLength(s);
	}
	public String getLabelText(){
		return new String("Height ("+un.getUnitsLength().trim()+"):");
	}
	public Label getLabel(){
		return new Label(getLabelText());
	}
}
	DataEntry weight;
	DataEntry height;
	DataEntry bmi;
	double wt=0.0,ht=0.0,bmit=0.0;
	public BMIField(String s, int n, DataEntry w, DataEntry h,
		DataEntry b){
		super(s,n);
	}
	public void update(Observable o, Object obj){
		String value;
		wt=weight.getDataAsDouble();
		ht=height.getDataAsDouble();
		bmit=(0.45*wt)/((0.025*ht)*(0.025*ht));
		value=(new Double(bmit).toString());
		bmi.setData(value);
		this.setText(value);
	}
}
  Observer{
	Units units=new Units();
	Panel row1=new Panel();
	Panel row2=new Panel();
	Panel row3=new Panel();
	DataEntry weight=new DataEntry();
	WeightField weightField=new WeightField("",8,weight,units);
	Label weightLabel=weightField.getLabel();
	DataEntry height=new DataEntry();
	HeightField heightField=new HeightField("",8,height,units);
	Label heightLabel=heightField.getLabel();
	DataEntry bmi=new DataEntry();
	Field bmiField=new BMIField("",7,weight,height,bmi);
	Label bmiLabel=new Label("Body Mass Index =");
	
	public void init(){
		setLayout(new GridLayout(0,1));
		row1.add(units.mcb);
		row1.add(units.ucb);
		units.addObserver(this);
		units.addObserver(weightField);
		units.addObserver(heightField);
		row2.add(weightLabel);
		row2.add(weightField);
		row2.add(heightLabel);
		row2.add(heightField);
		weight.addObserver(bmiField);
		height.addObserver(bmiField);
		row3.add(bmiLabel);
		row3.add(bmiField);
		add(row1);
		add(row2);
		add(row3);
		show();
	}
	public void update(Observable o, Object obj){
	}
}