SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Walter Savitch ,julia Lobur
Chapter:
Functions For All Subtasks
Exercise:
Programming Projects
Question:14 | ISBN:9780321531346 | Edition: 7

Question

In cold weather, meteorologists report an index called the windchill factor, that takes into account the wind speed and the temperature. The indexProgramming Projects provides a measure of the chilling effect of wind at a given air temperature. Windchill may be approximated by the formula:
W = 13.12 + 0.6215 *t - 11.37*v 0.16 + 0.3965*t*v 0.016
where
v = wind speed in m/sec
t = temperature in degrees Celsius: t <= 10
W = windchill index (in degrees Celsius)
Write a function that returns the windchill index. Your code should ensure that the restriction on the temperature is not violated. Look up
some weather reports in back issues of a newspaper in your university library and compare the windchill index you calculate with the result
reported in the newspaper.

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

PROGRAM CODE:

#include<iostream>
#include<cmath>
using namespace std;
double meteorologistReport(double windspeed, double temperature,double windchillindex);
int main()
{
	double windspeed,temperature,windchillindex=0;
    cout<<"Please enter wind speed(m/sec): ";
	cin>>windspeed;
    cout<<"Please enter temperature(degrees celsius):";
	cin>>temperature;
	windchillindex = meteorologistReport(windspeed,temperature
                                       ,windchillindex);
     cout<<"The  windchill index is "<<windchillindex;
     return 0;
}
double meteorologistReport(double windspeed, double temperature
                                 ,double windchillindex)
{
	return windchillindex = (13.12+0.6215*temperature
            -11.37*pow(windspeed,0.16)+0.3965*temperature
                                   * pow(windspeed,0.016));
}

OUTPUT OF THE PROGRAM CODE:

Please enter wind speed(m/sec): 100
Please enter temperature(degrees Celsius):25
The  wind chill index is 15.5727

 

0 0

Discussions

Post the discussion to improve the above solution.