Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

an IPO chart showing the Input, Processing, and Output for this program AND a FLOWCHART, detailing the LOGIC of the program. * * * *

an IPO chart showing the Input, Processing, and Output for this program AND a FLOWCHART, detailing the LOGIC of the program.*************************************************************************
#include
#include
#include
#include
using namespace std;
//******************* P R I N T = L I N E F U N C T I O N ******************/
void printline()
{
for (int i =0; i <98; ++i){
cout <<"=";
}
cout << endl;
}
//********************** D E C L A R E V A R I A B L E S ********************/
int main()
{
float fahrenheit =0;
float celcius =0;
char scale; // F (fahrenheit to celcious) or C (celcius to fahrenheit)
float windchill_f =0;
float windchill_c =0;
int wind_speed_mph =0;
int wind_speed_kph =0;
time_t now = time(0); // get corrent date and time
tm* ltm = localtime(&now);
cout <<"===================================================================="<< endl;
cout <<"| Convert Temperature Program |"<< endl;
cout <<"| Program Created by |"<< endl;
cout <<"===================================================================="<< endl;
cout <<"| Do you Want to convert from Fahrenheit to Celcius (Type 'F')|"<< endl;
cout <<"| or do you Want to convert from Celcius to Fahrenheit (Type 'C')|"<< endl;
cout <<" Enter 'F' or 'C' : ";
cin >> scale;
scale = toupper(scale);
while (scale !='F' && scale !='C')
{
cout <<"************ I N P U T E R R O R ***********"<< endl;
cout << "Temperature Scale must be 'F' or 'C'"<< endl;
cout << "You entered a"<< scale <<". Please enter 'F' or 'C'"<< endl;
cin >> scale;
scale = toupper(scale);
}
if (scale =='F')
{
cout << "Enter The Fahrenheit Temperature: ";
cin >> fahrenheit;
celcius =(fahrenheit -32)/(9.0/5.0);
if (fahrenheit >50)
{
cout << "Wind Chill cannot be calculated when temperature is above 50\u00B0F"<< endl;
cout << "Your Temperature is "<< fahrenheit <<"\u00B0F"<<"("<< celcius <<"\u00B0C"<<")"<< endl;
}
else
{
cout << "What is the wind speed (in MPH): ";
cin >> wind_speed_mph;
wind_speed_kph = wind_speed_mph *1.609344;
}
if (wind_speed_mph <4)
{
cout << "Wind speed must be graeter than 3 MPH to calculate Wind Chill Factor" << endl;
}
else
{
windchill_f =35.74+(0.6215* fahrenheit)-35.75* pow( wind_speed_mph,0.16)+(0.4275* fahrenheit)* pow(wind_speed_mph,0.16);
windchill_c =13.12+(0.6215* celcius)-11.37* pow(wind_speed_kph,0.16)+(0.3965* celcius)* pow(wind_speed_kph,0.16);
}// close else for wind speed <3
}// close else for fahrenheit >50
else // Celsius section
{
cout << "Enter The Celcius Temperature: ";
cin >> celcius;
fahrenheit =(celcius *(9.0/5.0))+32;
if (celcius >10)
{
cout << "Wind Chill cannot be calculated when temperature is above 10\u00B0C"<< endl;
cout << "Your Temperature is "<< celcius <<"\u00B0C"<<"("<< fahrenheit <<"\u00B0F"<<")"<< endl;
}
else
{
cout << "What is the wind speed (in KPH): ";
cin >> wind_speed_kph;
wind_speed_mph = wind_speed_kph *0.6213711922;
}
if (wind_speed_kph <5)// actually 4.82803
{
cout << "Wind speed must be graeter than 4 KPH to calculate Wind Chill Factor" << endl;
}
else
{
windchill_f =35.74+(0.6215* fahrenheit)-35.75* pow( wind_speed_mph,0.16)+(0.4275* fahrenheit)* pow(wind_speed_mph,0.16);
windchill_c =13.12+(0.6215* celcius)-11.37* pow(wind_speed_kph,0.16)+(0.3965* celcius)* pow(wind_speed_kph,0.16);
}// close else for wind speed <5
}// close else for fahrenheit >10
//********************** P R I N T O U T S E C T I O N *********************/
printline();
cout <<"\t\t T E M P E R A T U R E & W I N D C H I L L P R O G R A M \t"

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Generative Artificial Intelligence For Project Management With Aws

Authors: Timothy Krimmel

1st Edition

B0CQV9KWB8, 979-8872627197

More Books

Students also viewed these Databases questions