CS1-Winter2001: Programming Project 1
Assigned January 11
Due Sunday before midnight January 28


Please perform the following activities. You may not work with anyone else on this first project assignment. You are allowed to talk with others, but your work must be your own.

Objective: The objective of this assignment is to practice coding programs that do (a) interactive input and output, (b) significant arithmetic computation, and (c) multiple selection operations. After this assignment you will understand how to write simple programs that compute useful things. Good programmers often write small programs to do a short, useful computation.

Problem: Produce a program that computes and displays the wind chill or the heat index (apparent temperatures) from user-supplied floating point values.

First prompt the user for the current temperature T in Fahrenheit. If the temperature T is at or above 80 you will compute the heat index. If the temperature is at or below 40 you will compute the wind chill. If the temperature is between 40 - 80, then we will consider the apparent temperature as the same as the actual. The formulae for apparent temperatures when the actual temperature is not between 40 - 80 are given as follows:

For the heat index
Prompt and read in a relative humidity percentage R. The formula we shall use to compute the heat index comes from the USA Today's weather website, and is as follows:

Heat Index = -42.379 + 2.04901523 * T + 10.14333127 * R - 0.22475541 * T * R - 6.83783e-03(T^2 ) - 5.481717e-02(R^2 ) + 1.22874e-03(T^2 * R) + 8.5282e-04(T * R^2 ) - 1.99e-06(T^2 * R^2 )

For the wind chill
Prompt and read in a wind speed V. The formula we use for the wind chill is as follows:

Wind Chill = 0.0817* (3.71 * SQRT(V) + 5.81 - 0.25 * V) * (T - 91.4) + 91.4

In addition to displaying the wind chill or heat index value, your program should display a danger message appropriate to the apparent temperature. The proper danger message to display is given by the following table.


Apparent temperature               Danger Message
-------------------                --------------
Greater than 130	           Extreme Danger - Heat stroke imminent
105 - 130		           Moderate Danger - Heat exhaustion likely 
90 - 105		           Extreme Caution - Heat cramps possible
80 - 90			           Caution - Exercise is more fatiguing
40 - 80		                   No Danger
20 - 40				   Caution- No shorts allowed
0  - 20				   Extreme Caution - Take a trip to Florida
-20 - 0				   Moderate Danger - Frostbite possible
Less than  -20			   Extreme Danger - Don't bother leaving bed


Examples: Suppose we have a temperature of 90 degrees Fahrenheit and a relative humidity of 65 percent. The heat index computed should be equal to 102.654, and hence the message "Extreme Caution..." should be displayed. Suppose we have a temperature of 24, and a wind speed of 17. Then the wind chill is -1.4, and hence the message "Moderate Danger...." should be displayed.

Remember to prompt the user for each input, then echo them in a meaningful fashion. All floating point values should use C++'s double representation.

Notes: Programming style is important. Be sure to use the standard header (i.e., your name, section number, etc.) in your program. The standard header for all our programs (unless instructed otherwise) will contain the following information:


// Programmer: 
// Student ID: 
// E-mail: 
// CS1 Lab Section: 
// CS1 Lab time: 

You should submit your program electronically to the TA before midnight on Sunday, January 28. The class website should contain detailed information on how to do this.