The apparent temperature or "heat index" combines the effects of heat and humidity. When heat and humidity combine to reduce the amount of evaporation of sweat from the body, outdoor exercise becomes dangerous even for those in good shape. Overheating can cause serious, even life-threatening conditions such as heat stroke.
If you know the relative humidity "rh" and the air temperature in Fahrenheit "T", then you can use the following equation to calculate the heat index.
Make a class called HotDay which has the following methods:
Use the class HotDayTester below which creates and tests Hot Days!!
public class HotDayTester { public static void main(String[] args){ HotDay hotday1 = new HotDay(70, 50); System.out.println("Temperature :" + hotday1.getTemperature()); System.out.println("Humidity :" + hotday1.getRelativeHumidity()); System.out.println("Heat Index :" + hotday1.heatIndex()); System.out.println("Heat Warning :" + hotday1.heatWarning()); System.out.println(""); hotday1.setTemperature(80); hotday1.setRelativeHumidity(50); System.out.println("Temperature :" + hotday1.getTemperature()); System.out.println("Humidity :" + hotday1.getRelativeHumidity()); System.out.println("Heat Index :" + hotday1.heatIndex()); System.out.println("Heat Warning :" + hotday1.heatWarning()); System.out.println(""); hotday1.setTemperature(90); hotday1.setRelativeHumidity(50); System.out.println("Temperature :" + hotday1.getTemperature()); System.out.println("Humidity :" + hotday1.getRelativeHumidity()); System.out.println("Heat Index :" + hotday1.heatIndex()); System.out.println("Heat Warning :" + hotday1.heatWarning()); System.out.println(""); hotday1.setTemperature(100); hotday1.setRelativeHumidity(50); System.out.println("Temperature :" + hotday1.getTemperature()); System.out.println("Humidity :" + hotday1.getRelativeHumidity()); System.out.println("Heat Index :" + hotday1.heatIndex()); System.out.println("Heat Warning :" + hotday1.heatWarning()); System.out.println(""); hotday1.setTemperature(80); hotday1.setRelativeHumidity(80); System.out.println("Temperature :" + hotday1.getTemperature()); System.out.println("Humidity :" + hotday1.getRelativeHumidity()); System.out.println("Heat Index :" + hotday1.heatIndex()); System.out.println("Heat Warning :" + hotday1.heatWarning()); System.out.println(""); hotday1.setTemperature(90); hotday1.setRelativeHumidity(80); System.out.println("Temperature :" + hotday1.getTemperature()); System.out.println("Humidity :" + hotday1.getRelativeHumidity()); System.out.println("Heat Index :" + hotday1.heatIndex()); System.out.println("Heat Warning :" + hotday1.heatWarning()); System.out.println(""); hotday1.setTemperature(100); hotday1.setRelativeHumidity(80); System.out.println("Temperature :" + hotday1.getTemperature()); System.out.println("Humidity :" + hotday1.getRelativeHumidity()); System.out.println("Heat Index :" + hotday1.heatIndex()); System.out.println("Heat Warning :" + hotday1.heatWarning()); System.out.println(""); } } ****************************************** OUTPUT OF TESTER ****************************************** Temperature :70 Humidity :50 Heat Index :77.0 Heat Warning :weathers fine... Temperature :80 Humidity :50 Heat Index :81.0 Heat Warning :CAUTION! Temperature :90 Humidity :50 Heat Index :95.0 Heat Warning :EXTREME CAUTION! Temperature :100 Humidity :50 Heat Index :118.0 Heat Warning :DANGER! Temperature :80 Humidity :80 Heat Index :84.0 Heat Warning :CAUTION! Temperature :90 Humidity :80 Heat Index :113.0 Heat Warning :DANGER! Temperature :100 Humidity :80 Heat Index :158.0 Heat Warning :EXTREME DANGER!