public class WeatherSensor {
    private Thermometer thermometer;
    private Barometer barometer;
    
    /**
     * A WeatherSensor using b and t.
     */
    public WeatherSensor(Thermometer t, Barometer b) {
        thermometer = t;
        barometer = b;
    }
    
    /**
     * = "this WeatherSensor is equal to w: the thermometers and
     * barometers are equal."
     */
    public boolean equals(WeatherSensor w) {
        return w != null
          && ((thermometer == null && w.thermometer == null)
            || (thermometer != null && thermometer.equals(w.thermometer)))
          && ((barometer == null && w.barometer == null)
            || (barometer != null && barometer.equals(w.barometer)));
    }
    
}
