Question 3 write a program that estimates the temperature in a freezer (in Celsi
ID: 3623585 • Letter: Q
Question
Question 3write a program that estimates the temperature in a freezer (in Celsius)
given the elapsed time (hours) since a power failure. Assume this temperature (T) is given by
T=(4t^2/(t+2)) - 20
where t is the time since power failure. your program should prompt the user to enter how long it has been since the start of the power failure in whole hours and minutes. note that you will need to convert the elapsed time into hours. for example, if the user entered 2.30 (2 hours 30 minutes) you will need to convert this to 2.5 hours.
Explanation / Answer
please rate - thanks
#include<iostream>
using namespace std;
int main()
{double t,T;
int h,m;
cout<<"how long it has been since the start of the power failure in whole hours and minutes: ";
cin>>t;
h=(int)t;
m=(int)(t*100);
m=m%100;
t=h+m/60.;
T=(4*(t*t)/(t+2))-20.;
cout<<"The freezer temperature is currently about "<<T<<endl;
system("pause");
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.