Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ 1) Crime Scene Investigation Newton's Law of Heating and Cooling states that the rate of change of the temperature function T(t) with respect to
C++
1) Crime Scene Investigation Newton's Law of Heating and Cooling states that the rate of change of the temperature function T(t) with respect to time t of an object is proportional to the difference between the object's temperature and its surrounding's temperature, Ts. Here assume Ts is a constant. We can write this as AT/At = k (Ts-T) where AT is the change in temperature over time step At and k is the growth rate (heating) or decay rate cooling) per unit time. We can now simulate the heating or cooling of an object using T(t) = T(t - At) + k [T, - Tt - At)] (At), or new_temperature = old_temperature + change_in_temperature, where T(t) is the new temperature at time t and T(t-At) is the temperature at time t-At. For example, suppose cold water at 6 degrees Celsius is placed in a room that has temperature 25 degrees Celsius. If the time step At is 0.1 hour and k is 1.335, then the temperature after the first time step is T(0.1) = 6 + 1.335 (25-6)(0.1) = 8.5365 degrees Celsius. and the next computed time would be: T(0.2) = 8.5365 + 1.335 (25 8.5365)(0.1) = 10.734 degrees Celsius. Write a program to simulate the heating or cooling of an object over a time period (i.e., the simulation length). Include the following: Prompt the user, and have him or her input values of the initial temperature, the temperature of the surroundings, the growth decay) rate, the length of the time step, and the simulation length. Using a while loop do the following: In each iteration of the loop, calculate the time t and the new temperature T(t). In each iteration, display t and T(t). Continue the loop as long as time t is less than the simulation length. Example: Enter the initial temperature: 6 Enter the temperature of the surroundings: 25 Enter the growth (decay) rate: 1.335 Enter the time step in hours: .1 Enter the simulation length in hours: 2 0.100000 8.536500 0.200000 10.734377 0.300000 12.638838 0.400000 14.289053 0.500000 15.718964 0.600000 16.957983 0.700000 18.031592 0.800000 18.961874 0.900000 19.767964 1.000000 1.100000 1.200000 1.300000 1.400000 1.500000 1.600000 1.700000 1.800000 1.900000 2.000000 20.466441 21.071671 21.596103 22.050523 22.444278 22.785467 23. 081107 23.337280 23.559253 23.751592 23.918255 Suppose someone whose body temperature was originally 37C is murdered in a room that has a constant temperature of 25C. The body was discovered at 10:00pm with a temperature of 28 C. Use your program to determine at what time the murder was committed. Assume k = 0.4055 and use a time step of 0.1 hoursStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started