You’re not passing any information into Weatherstation to calculate, so all the variables are zero.
Add a constructor like so:
public Weatherstation(double temperature, double windspeed, double windChillTemperature, double actualTemperature, double actualSpeed) {
this.temperature = temperature;
this.windspeed = windspeed;
this.windChillTemperature = windChillTemperature;
this.actualTemperature = actualTemperature;
this.actualSpeed = actualSpeed;
}
Then modify your test class to pass in the variables:
public class WeatherstationTester {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
for (int i = 0; i <= 10; i++) {
Weatherstation w1 = new Weatherstation(i, i, i, i, i);
w1.generateWeatherMessage();
}
}
}
CLICK HERE to find out more related problems solutions.