Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zzlalani/a1b687b39a1785ecaae85f92762ee99b to your computer and use it in GitHub Desktop.
Save zzlalani/a1b687b39a1785ecaae85f92762ee99b to your computer and use it in GitHub Desktop.
Develop the design of the weather station in detail by proposing interface descriptions of the objects shown in Figure 14.11. These may be expressed in Java, in C++ or in the UMl
class WeatherStation {
private int identifier;
public void reportWeather();
public void calibrate (Instrument instrument);
public void test();
public void startUp(Instrument instrument);
public void shutDown(Instrument instrument);
}
class WeatherData {
private float airTemperatures, groundTemperatures, windSpeeds;
private float windDirections, pressures, rainfall;
public void collect();
public void summarise();
}
abstract class Instrument {
public void test();
public void calibrate();
}
class Groundthermometer extends Instrument {
private float temperature;
public void test();
public void calibrate();
}
class Anemometer extends Instrument {
private float windSpeed, windDirection;
public void test();
public void calibrate(); // empty overrided function, no implementation
}
class Barometer extends Instrument {
private float pressure, height;
public void test();
public void calibrate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment