Assignment (6)

CS1440 – Due October 27, 2000

1.

Write a C++ program using the structure chart given on page (4) to compute the wind chill factor for a single case or for a case where an input file is provided.Your program has to have three options:

1)Run the program for a single case (input v and t and compute W, exit)

2)Run the program for an input file (use input file, compute Ws, exit)

3)Quit

The formula for computing wind chill factor is:

Where, v = wind speed in m/sec, t = temperature in degree Celsius: t <= 10, W = wind chill index (in degree Celsius).

Where do you get the required data from? 

You will use Dr. Ray Russell’s weather page(http://www.booneweather.com/index.shtml) to create your input files.Follow the following steps to get the data.
Step (1) : go to the Booneweather web page using the above address (URL).
Step (2) : under “Ray's Weather Almanac” on the left, click on “Boone Weather Archive
Step (3) : Choose “November 1999 Summary
You will see a table that looks like the table that is attached to the assignment on page (3).You need to make two input files.The first one is called “highhigh.dat”, and the second one is called “midmid.dat”.Here is the procedure for preparing the input files:
Step(4):

Preparing“highhigh.dat” file: Use pico to open a blank file on cs (% pico highhigh.dat) and copy the high temperature (3rd column on the table) for the first column of your input file and the high wind speed (11th column on the table) for the second column of your input file.Example:

59.019.0

59.534.0

….…..

Note that there is a single blank space between the two numbers.Once you copy all data for 30 days, save the file and exit.

Preparing“midmid.dat” file: Copy the mean temperature (2nd column on the table) for the first column of your input file and the high wind speed (10th column on the table) for the second column of your input file.Example:

53.71.8

47.38.7

….…..

Once you copy all data for 30 days, save the file and exit.

You will read these two files and will generate two output files one for each input.The output files should include (Use 2 decimal points only to represent the real values). 

DayWind SpeedTemperatureWind Chill

===================================================

11.853.7???

Call the output file corresponding to the highhigh.dat input high.out and the one corresponding to the midmid.dat input file mid.out.

Description of some of the functions

Instructions : Print the instructions regarding what the program will do and how it does is. It includes proper comments for choice and units.It has to state that the wind chill is in Celsius.
Menu : Will return an integer representing one of the three choices explained above.
Unit_Choice: This function will return the choice for the units used for temperature and speed.Note that you have to use m/sec for speed and Celsius for temperature in the formula given to obtain the wind chill in Celsius.Thus, if you have the temperature in Fahrenheit and speed in mp/h (that is the case in the given table), you need to convert them.This function returns two values (v_unit and t_unit) based on which you will determine whether you need a conversion or not.The best way is to use 0 when you do not need conversion and 1 or any other number when you need it.These come from the keyboard.
Comp_W : Will compute the formula.It calls Get_TV to get the values for temperature and speed, then it calls the Convert­_V and/or Covert_T to convert t and v to proper units and finally will return the values shown on the chart.