Documente Academic
Documente Profesional
Documente Cultură
COMPUTER PROGRAMMING
NAME
MATRIC NO.
SX130588KAWS04
SESSION - SEM
2014/2015 - 1
SECTION
03
LECTURER
SKAA 3413
Computer Programming
1415-1
Flow Chart
1) Draw flow chart for each of the following. Determine the;
a) magnitude of the resultant of four concurrent forces.
b) moment of inertia of a U cross section about the centroidal x-axis.
c) hydraulic radius of a trapezoidal cross section.
d) perimeter of a quadrilateral.
(a)
(b)
(c)
(d)
2) A simply supported beam carries two point loads. Draw flow chart to determine the,
a) location of the maximum bending moment.
b) bending moment at a point specified by the user.
3) The current calendar, called the Gregorian calendar, was introduced in 1582. Every year divisible by 4 was
declared to be a leap year, with the exception of the year ending with 00 (divisible by 100) and not divisible by
400. For instance, the years 1600 and 2000 are leap years, but 1700, 1800 and 1900 are not. Request a year as
input and states whether or not it is a leap year.
Note: Reject input which is less than 1582.
4) Determine average compressive strength of concrete cubes (say the number of cube is n), but excluding the
strength of the strongest and the weakest cubes.
5) Draw flow chart to determine how many times a ball bounces when dropped from its initial height before it
rises to a height of less than 10 cm and the total distance traveled by the ball before this point.
The coefficient of restitution (r) of a ball specifies how much energy is conserved when a ball hits a rigid
surface. A coefficient of 0.7, means a bouncing ball will rise to 70 % of its previous height after each bounce.
Note: Initial height must be greater than 10 and 0 < r < 1.
6) Determine the minimum number of plank layers of a glue laminated beam to satisfy the specified required
moment of inertia. The width and the thickness of the plank are also to be specified by the user. The overall
depth of the beam must not be greater than 50 cm; if this condition is not fulfilled, increase the width of the
plank.
Tutorial 2
Figure below shows a figure of a truss. Assume that L1 = 1000N, L2 = 500N, L3 = 1000N
i)
ii)
Build a flow chart and pseudo code for a program to calculate forces in each member
Build a script in MATLAB to calculate the forces in each member.
Variable
Remarks
Status
--------
-------
------
L1,L2,L3
To be computed
To be computed
Fbc,Fdb,Fde
To be computed
Theta1
To be computed
Theta2
To be computed
Theta3
To be computed
Rxa
To be computed
Rya
To be computed
Rxb
To be computed
Ryb
To be computed
1a)
Resultant Force
Pseudo Code
1.
2.
3.
4.
5.
Calculate FR & R .
6.
Flow Chart
Start
Input n
Input F1 , 1
to Fn , n
Fxn = Fn cos n
Fy n = Fn sin n
FR =
( Fx ) + ( Fy )
2
Fy
Fx
R = tan 1
Display FR and R
End
1/10
1b)
Moment of Inertia
Pseudo Code
1.
2.
Calculate area.
3.
4.
5.
Flow Chart
Start
Input b1 , h1 , b2 , h2
A1 = b1h1 , A2 = b2 h2
y1 = h1 2 , y2 = ( 2 h1 h2 ) 2
y = ( A1 y1 A2 y 2 )
( A1 A2 )
d1 = y1 y , d2 = y2 y
I1 = b1h13 12
I 2 = b2 h23 12
I xx = ( I1 + A1d12 ) ( I 2 + A2 d2 2 )
Display I xx
End
2/10
1c)
Hydraulic Radius
Pseudo Code
1.
2.
Calculate angle.
3.
Calculate area.
4.
5.
6.
Flow Chart
Start
Input d, r
= 2 cos 1 1
r
A=
in radian
r2
( sin )
2
P = r
R=
A
P
Display R
End
3/10
1d)
Perimeter
Pseudo Code
1.
2.
3.
4.
Calculate perimeter.
5.
Flow Chart
Start
Input n
Input all x,y
S=
( xA xB ) + ( yA yB )
2
P = sum ( S )
Display P
End
4/10
2)
Simple Beam
Pseudo Code
1.
2.
3.
Input distance x.
4.
Calculate reaction.
5.
6.
7.
Display result.
Flow Chart
Start
Input L, P1 , a, P2 , b, x
P1 ( L a ) + P2 ( L b )
L
RB = P1 + P2 RA
RA =
M max = max ( R A a , R Ab P1 ( b a ) )
xmax = a
True
M max RA = a
M x = R A x P1 ( x a ) P2 ( x b )
False
xmax = b
(( x a ) < 0 ) = 0
(( x b ) < 0 ) = 0
End
5/10
3)
Leap Year
Pseudo Code
1.
Input year.
2.
3.
4.
Display result.
Flow Chart
Start
Input year, yr
yr < 1582
True
False
True
4 /| yr or
100 | yr & 400 /| yr
Display yr
common
False
Display yr
leap
End
6/10
4)
Average Strength
Pseudo Code
1.
2.
3.
4.
Flow Chart
Start
Input n
Input 1 to n
max min
n2
Display
End
7/10
5)
Ball Bounces
Pseudo Code
1.
2.
3.
Calculate bouncing height, b and sum b using geometric series until b < 10.
4.
5.
Display result.
Flow Chart
Start
Input h
h > 10
False
True
Input r
0 < r <1
False
True
n=0
d =h
hr n 10
n = n + 1 , b = hr n
r n 1
d = 2h
h
r 1
True
False
Display n, d, b
End
8/10
6)
Glulam Beam
Pseudo Code
1.
2.
3.
4.
If tn > 50, input greater plank width and repeat from step 3, otherwise
proceed.
5.
Display result.
Flow Chart
Start
Input I and t
Input b
request greater b
3
12I
n =
b
nt > 50
True
False
Display n
End
9/10
7)
Truss
Pseudo Code
1.
2.
3.
4.
5.
6.
Display result.
Flow Chart
Start
( x1 x2 ) + ( y1 y2 )
2
Display:
Rxa, Rya, Rxb, Ryb
Length of each member
Force of each member
End
10/10