The medical examiner arrives at the crime scene and takes the temperature, T_i, of the deceased. An hour later the medical examiner again takes the temperature T_f of the deceased. The examiner notices that the thermostat in the room is set for a constant T_a temperature. From this data and Newton's Law of Cooling, design, write, compile, run and debug a program that takes in (use cin) temperatures T_i, T_f and T_a in degrees Fahrenheit from the user and displays those temperatures, constant k, and the approximate length of time t_h in hours between the death of the individual and the arrival of the examiner (assume the individual's body temperature was T_d = 98.6 degrees Fahrenheit at the time of death).
Step 1: Determine constant k from: k = (-log((T_f - T_a)/(T_i - T_a)))/1.0
Step 2: Determine t_h in hours from: t_h = (-log((T_i - T_a)/(T_d - T_a)))/k
Step 3: Print out the value of t_h in hours.
[EDIT - OP code from comment]
okay, so I did my best but the answer it gives me don't seem like a right answer..... Im not sure if I did something wrong
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
double T_i,T_f,T_a,k,T_h;
const double T_d = 98.6;
cout<< "Determine length of time t_h in hours between the death of the individual and the arrival of the examiner "<<endl<<endl;
cout<< "Enter the value of T_i: ";
cin>> T_i;
cout<< "Enter the value of T_f: ";
cin>> T_f;
cout<< "Enter the value of T_a: ";
cin>> T_a;
k = (-log((T_f - T_a)/(T_i - T_a)))/1.0;
T_h = (-log((T_i - T_a)/(T_d - T_a)))/k;
cout<< setiosflags(ios::fixed)
<< setiosflags(ios::showpoint)
<< setprecision(4)
<< "time between the death of the individual and the arrival of the examiner:"<<T_h<< "hours"<<endl;
return 0;
}