The code for the dice program is here.
The Stimsonian Institute was so impressed by your bridge program that they gave you 100 kg of Wacky Glue and 1024 sticks of balsa wood. One problem the Institute has is that engineers have determined that their elevator has a weak cable and is about to break. This is frightening because the Institute is on the forty-second floor in a building where each floor is 3.2 meters. Unfortunately, the Institute doesn't have the budget to repair the elevator because they spent all the money donated from the Steven Dodd Foundation on purchasing additional cantaloupes and watermelons for their weekly fruit salad luncheons.
We know from Newton's Second Law that the force required to pull the elevator is:
F = m (a + g)
, where m is the mass of the elevator and passengers, a is the acceleration, and g is the acceleration due to gravity. We know from Lab 02 that g = 9.80665. We also know from the elevator's repair manual that the elevator is programmed to ascend with a constant acceleration of a = 2.0. We also know, assuming the elevator doesn't stop along the way, the ride from the first floor to the forty-second floor is 11.5931 seconds. So the amount of impulse for each ride is:
I = 136.876m
Write a program that will operate the elevator 4 times for different masses each time. Keep track of the total impulse applied to the elevator cable using the equation above and report it to the user (if you're curious, the units of impulse are N · s). Also, make sure that the mass of the elevator is at least 100 kg (which is the mass of the elevator with no passengers) and no more than 1000 kg (the carrying capacity of the elevator).
Engineers further studied the elevator and determined that the probability of the elevator cable breaking is:
![]()
, where r is a random integer from 1 to I. Extend your Part I to calculate whether the elevator's cable has broken and report it to the user. HINT: You need to #include <cstdlib> and #include <ctime> to use the srand(), rand(), and time() functions. Then randomly decide whether the cable has broken. You can be creative on how you decide, but you MUST use P from the previous equation.
Extend your Part III to calculate the amount of time and final impact velocity of the elevator once the cables break. Assume the cable always breaks right at the forty-second floor. The elevator will then start to fall, but since is in an elevator shaft and not a vacuum, will fall subject to air drag. Using air drag, we can't use the equations we used in Lab 02 since acceleration is no longer constant. Stimsonian Physicists have derived the following approximations for acceleration, a, velocity, v, and displacement x:

, where t is the amount of time in seconds the object has been falling.
![[Dilbert]](dilbert.gif)