CS19002 Programming and Data Structures Laboratory, Section 5

Spring 2007

Assignment 0

Submission site  |  Show solution  |  Hide solution ]

Suppose it is a cold day and you go out shopping. You gather from weather forecasts that the outside temperature would be around 8 degree Celsius. You put on warm clothes accordingly. Once you go out, you encounter a gentle breeze. You feel a little uncomfortable, but manage to reach the mall, and finish a big shopping. On your way back, you find that the wind speed has increased considerably, and you start shivering in cold. You curse all weather forecast programs and conclude that the temperature must be much less than 8 degrees.

You are both right and wrong. The ambient temperature is 8 degrees. However, because of the wind you feel a colder temperature. This apparent lowering of temperature is caused by an increased rate of evaporation of moisture from the exposed part of your skin and is called wind chill.

The wind chill temperature (i.e., the apparent temperature you feel) is a function of both the actual air temperature and the speed of the wind. Several approximate formulas exist for computing the wind chill temperature. The feeling may vary from person to person, may be different at different places, and may depend on other factors like humidity. Nonetheless, here is a well-accepted formula:

Twc = 13.12 + 0.6215 T - 11.37 V0.16 + 0.3965 T V0.16.

Here T is the actual air temperature in degree Celsius, V the wind speed in km/hr, and Twc the wind chill temperature in degree Celsius. This formula is not meaningful at very low and very high wind speeds (for example, below 6.5 km/hr or above 90 km/hr).

Part 1
Write a program that reads values for T and V from the user and computes and displays the corresponding wind chill temperature Twc.

Part 2
Suppose that your friend from US is more comfortable with temperatures measured in degrees Fahrenheit and speeds measured in miles/hr. Convert the above formula to one suited to these measurement units. Print this converted formula. Note that if F degree Fahrenheit is the same as C degree Celsius, then we have C/5 = (F-32)/9. Moreover, 1 mile = 1.6 km.

Write the same program for the two parts. Report the output of your program on the following input values:

   T = 8, V = 10
   T = 8, V = 40
   T = 4, V = 20
   T = -10, V = 25
   T = -20, V = 35

Submission site  |  Show solution  |  Hide solution ]

Back  |  Home