C++ Programming for Engineers
Programming Assignment: Beam Deflection
The analysis of beams is an important topic in mechanical engineering. One type of beam considered is a
cantilever beam in which one end of the beam is fixed and the other end of the beam is free.
When a weight, W, (or load) is applied the free end of the beam, the beam deflects or bends. The amount of
deflection, , on the free end of the beam depends on the beams loading conditions.
There are many types of loading conditions, but three types are considered here:
1) End load - A single load, W, is applied at the free end of the beam
2) Intermediate Load – A single load, W, is applied at point B (somewhere between the free end and the
3) Uniform Load – The load W is uniformly distributed along the length of the beam
The three types of loading are illustrated below:
W = total weight of load (N)
δ = deflection caused by the load (m)
x = distance from the free end of the beam (m)
l = L = length of the beam (m)
w = load density (N/m)
For a uniform load, W = wL [note: (N/m)(m)=N]
The deflection for each beam can be calculated using the following relationships, assuming that the forces on
the beam are coplanar, the beam is in static equilibrium, and that the weight of the beam may be neglected.
1) End Load:
2) Intermediate Load:
3) Uniform Load:
E = Young’s modulus of elasticity (N/m2)
I = moment of inertia (m4)
L = length of beam (m)
For the Intermediate Load, the following terms also apply:
a = distance from fixed end of beam to application of the load (m)
b = L – a
For the Uniform Load: Weight = (Weight Density)(Beam Length) or W = (w)(L)
Young’s modulus of elasticity varies with different types of materials. The following are typical values:
Material Young’s modulus (N/m2
Aluminum 6.90 x 10
Brass 11.7 x 10
Carbon Steel 20.5 x 10
Cast Iron 10.0 x 10
Oak 1.10 x 10
Stainless Steel 19.0 x 10
Titanium 11.4 x 10
It will be assumed that the beam under consideration is an I-beam with the following dimensions:
H outer height of I - Beam (m)
h inner height of I - Beam (m)
B outer width of I - Beam (m)
b width of both flanges of I - Beam (m)
The moment of inertia, I,for the I - Beam can be calculated as follows :
Write a C++ program according to the following specifications
1. Display a brief description of the program.
2. Ask the user to specify the type of loading (end load, intermediate load, uniform load). Display sketches of
the beam configuration and I-Beam shape with variables labeled to be sure that the user understands what
you are asking for.
3. Ask the user to specify the type of material (give the user of menu of 7 material types listed above) and then
use the given value of E.
4. Ask the user for the beam dimensions (L, B, b, H, and h). Use a c++ function to find the moment of inertia.
5. If an end load or intermediate load is chosen, prompt the user to enter the weight of the load.
6. If a uniform load is selected, prompt the user to enter the weight density.
7. If an intermediate load is chosen, prompt the user to enter the value of b. (Note: This is the b on the
intermediate load diagram where a + b = L, not the b used in the beam dimension. You might want to
8. Create 3 c++functions to calculate δ for the three types of loading.
9. Prompt the user to specify the number of points, N (in addition to x = 0) to use in a table of x and values.
10. Neatly display the following:
A brief description of the program.
The type of loading and type of material.
All input quantities (both variable and name) with units. Also display I.
Display a table of values of x and δ with an appropriate table heading (with units) and with all values
nicely aligned. Add lines to the table.
Other important notes:
User prompts should include both symbol and name of variable and unit.
Use scientific notation with 3 digits after the decimal point for most results.
Check all inputs for errors. If any inputs are entered incorrectly, allow the user to correct them.
Error checks include:
o Incorrect menu choices
o All beam dimensions, weights, and weight density must be positive
o H > h, B > b, L > a, and a > 0.
Give the user the option of re-running the program
Example: End Load, Carbon Steel I-Beam with B = 0.02 m, H = 0.04 m, b = 0.015 m, h = 0.03 m, W = 125 N,
L = 2 m, and N = 10. (Note: required formatting not used)
Run the program for the following test cases and turn in printouts of the results with your report.
Inbox your program to me.
Loading Material L (m) H (m) H (m) B (m) B (m) N W (N) W (N/m) a (m)
2 0.04 0.03 0.02 0.015 10 125
Intermediate Aluminum 10 0.05 0.04 0.025 0.02 20 500 5
Uniform Brass 0.5 0.06 0.04 0.03 0.024 15 300
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme