UMBC CMSC 104 CSEE | 104 | current 104

CMSC104, Fall 2005

Programming Project 3

How Cold is It?!?

Out: Friday, November 18, 2005
Due Date: Friday, December 2, 2005 before 11:59PM


The Objective

This project is designed to give you practice working with functions. It will also give you more practice working with loops.

The Background

With winter right around the corner, cold weather is on its way. Everyone knows that when the weatherperson says the temperature is 35 degrees, you might walk outside to find it feels like it is only 10 degrees or maybe even lower. It all depends on the wind! The wind causes it to feel a lot colder than it actually is. You have decided to prepare yourself for Winter by creating software that can give an approximate windchill temperature. As long as you know the temperature and the wind speed outside (current weather conditions), you can calculate the approximate windchill temperature. Before you leave the house, you can be sure that you are dressed appropriately!

The Task

Your job is to write a program that will accept as input the temperature and the wind speed and will output the windchill temperature. You should use the following formula to calculate the windchill temperature:

UPDATE: Correction to formula. Amount in red used to be 163.12
W = 13.12 + 0.6215 * t - 11.37 * v 0.16 + 0.3965 * t * v 0.16

where

   v = wind speed in km/hr

   t = temperature in degrees Celsius

   W = windchill temperature (in degrees Celsius)

Wait a minute! The formula given for windchill temperature expects the temperature in Celsius and the wind speed in kilometers per hour. Since we are used to thinking in terms of Fahrenheit and miles per hour, this presents a slight problem. Your solution is to convert the input from the user into its appropriate form before calculating the windchill temperature. You will accept the temperature in degrees Fahrenheit and convert it to degrees Celsius. You will accept the wind speed in miles per hour and convert it to kilometers per hour. Since this project involves functions, you will write the functions needed to do the conversions mentioned above.

For this project, since it is your first using functions, I am providing you with the function prototypes needed. You must use the following function prototypes EXACTLY. You may not change them in any way. However, you may use additional functions if you wish.



More Details

Sample Output

linux2[176]% gcc -ansi -Wall proj3.c  -lm
linux2[177]% a.out

[Your greeting goes here.]

Please enter a temperature (in degrees Fahrenheit): 35
Please enter the wind speed (in mph): 35

*******************************************************
*    Brrr! The windchill temperature is  21 F   --    *
*           Don't forget your coat!!                  *
*******************************************************


Would you like to enter another temperature (y or n)? y
Please enter a temperature (in degrees Fahrenheit): 30
Please enter the wind speed (in mph): 35

*******************************************************
*    Brrr! The windchill temperature is  14 F   --    *
*          Don't forget your hat, scarf & gloves!!    *
*******************************************************


Would you like to enter another temperature (y or n)? y
Please enter a temperature (in degrees Fahrenheit): 10
Please enter the wind speed (in mph): 35

*******************************************************
*    Brrr! The windchill temperature is -14 F   --    *
*          Don't even bother going out!!              *
*******************************************************


Would you like to enter another temperature (y or n)? y
Please enter a temperature (in degrees Fahrenheit): 60
The temperature must be less than or equal to 50.
Please enter a new temperature: 65
The temperature must be less than or equal to 50.
Please enter a new temperature: 30
Please enter the wind speed (in mph): -4
The number must be greater than 0.
Please enter another number: -10
The number must be greater than 0.
Please enter another number: 40


*******************************************************
*    Brrr! The windchill temperature is  13 F   --    *
*          Don't forget your hat, scarf & gloves!!    *
*******************************************************


Would you like to enter another temperature (y or n)? n

Stay warm!!

linux2[178]%


Submitting the Program

Here is a sample submission command. Note that the project name starts with uppercase 'P'.

submit cs104_0201 Proj3 proj3.c

To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show the file that you submitted in a format similar to the Unix 'ls' command.

submitls cs104_0201 Proj3