Write a program to solve programming exercise 26 on page 302 which creates a dice rolling simulator. Call it hw4aABC.cpp where ABC is your initials. You will need to review section 6.5Random Numbers to create the program. Be sure to create an output file to report the results of the test. Simulate 25 rolls of the dice and report the number of times each value is reported. You must set a new seed value using srand() as described in the section and shown in the chapter examples. A way to set it to a new value continuously is to use the computer clock and this will involve additional investigating online! Modify the problem statement by reporting the percentage of all rolls of the dice (when the sum of the 2 dice is 2,3,4..11, 12) not just the number of times the sum eight is returned as stated in the textbook.
Note: If you increase the number of rolls in your program you should see the percentages approach the actual probabilities of seeing a roll. For example you have a 1 in 36 chance to roll a 2 or a 12 total.
To design a square timber column in a structure, three formulas must be satisfied:
Buckling load:
Maximum load = (.3 x E x Area) / (Length / Width)^2
Compressive stress:
Maximum load = Area x Maximum compressive strength
Slenderness limit:
Length / Width <= 50
where :
E = the modulus of elasticity = 1,700,000 lb/in2
Area = the cross sectional area in square inches
Maximum compressive strength = 445 lb/in2
for a Douglas Fir tree.
Write a program called hw4bABC.cpp where ABC is your initials that uses these three formulas to give an initial design to a structural engineer. Assume the columns to be used are square in cross-section and are available in intervals of 2 inches (i.e. 2 by 2, 4 by 4, 6 by 6 and so on). Have the output look like the following:
Please enter the expected load in pounds> 9000
Please enter the length of the column in inches> 120
….Testing a beam with Area of 2.0 by 2.0 inches – Failed the tests
….Testing a beam with Area of 4.0 by 4.0 inches – Failed the tests
….Testing a beam with Area of 6.0 by 6.0 inches – Passed the tests
For a load of 9000.0 pounds and a length of 120.0 inches, recommended square beam has sides of 6.0 inches
You must write a function for each of the three tests using call by value. Your main program will call these three functions in order to solve the problem. Test your program for the above input and for the case of 18000 lb load and column length 72 inches.