Question: This is a C++ problem. Please give full explanation and code in details. Thanks. Newton's Law of Heating and Cooling states that the rate of

 This is a C++ problem. Please give full explanation and code

in details. Thanks. Newton's Law of Heating and Cooling states that the

This is a C++ problem. Please give full explanation and code in details. Thanks.

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, T. Here assume Ts is a constant. We can write this as 1 = k (T-T) where is the change in temperature over time step 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 new temperature-old temperature + change in temperature, where Ti) is the new temperature at time t and TA) is the temperature at time t- For example, suppose cold water at 6 degrees Celsius is placed in a room that has temperature 25 degrees Celsius. If the time step is O. 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 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 1. 2. a) In each iteration of the loop, calculate the time t and the new temperature T(t) b) In each iteration, display t and T(t). Use the formatting shown in the example below. c) Repeat the loop again if the 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 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 20.466441 1.100000 21.071671 1.200000 21.596103 1.300000 22.050523 1.400000 22.444278 8.536500 1.500000 22.785467 1.600000 23.081107 1.700000 23.337280 1.800000 23.559253 1.900000 23.751592 2.000000 23.918255 Suppose someone whose body temperature was originally 37 C is murdered in a room that has a constant temperature of 25 C. 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 hours

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!