SKAA 3413
COMPUTER PROGRAMMING
ASSIGNMENT 1: FLOW CHART
NAME
MUHAMMAD ASYRAF BIN MASRI
MATRIC NO.
SX130588KAWS04
SESSION - SEM
2014/2015 - 1
SECTION
03
LECTURER
DR. PONSELVI JEEVARAGAGAM
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
Forces applied at joints C, E, D respectively To be computed
Lac,Lab,Lcd,Lce Lengths of different truss members
To be computed
Fac,Fab,Fcd,Fce Forces in different truss members
To be computed
Fbc,Fdb,Fde
Forces in different truss members
To be computed
Theta1
Angle between CE and DE
To be computed
Theta2
Angle between AC and BC
To be computed
Theta3
Angle between BC and BD
To be computed
Rxa
Reaction at point A along X axis
To be computed
Rya
Reaction at point A along Y axis
To be computed
Rxb
Reaction at point B along X axis
To be computed
Ryb
Reaction at point B along Y axis
To be computed
SPACE Semester 1 2014/2015
SKAA 3413 Computer Programming
1a)
Muhammad Asyraf bin Masri
SX130588KAWS04
Resultant Force
Pseudo Code
1.
Input number of forces, n.
2.
Input magnitude and direction for each forces.
3.
Calculate Fx & Fy for each forces.
4.
Calculate total Fx & total Fy .
5.
Calculate FR & R .
6.
Display resultant force and direction.
Flow Chart
Start
Input n
Input F1 , 1
to Fn , n
Fxn = Fn cos n
Fy n = Fn sin n
Fx = Fx1 + ... + Fxn
Fy = Fy1 + ... + Fyn
FR =
( Fx ) + ( Fy )
2
Fy
Fx
R = tan 1
Display FR and R
End
1/10
SPACE Semester 1 2014/2015
SKAA 3413 Computer Programming
1b)
Muhammad Asyraf bin Masri
SX130588KAWS04
Moment of Inertia
Pseudo Code
1.
Input dimension of U section.
2.
Calculate area.
3.
Calculate y1 , y2 & y , calculate axis distance, d1 & d 2 .
4.
Calculate moment of inertia.
5.
Display moment of inertia.
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
SPACE Semester 1 2014/2015
SKAA 3413 Computer Programming
1c)
Muhammad Asyraf bin Masri
SX130588KAWS04
Hydraulic Radius
Pseudo Code
1.
Input depth, d and radius, r.
2.
Calculate angle.
3.
Calculate area.
4.
Calculate wetted perimeter.
5.
Calculate hydraulic radius.
6.
Display hydraulic radius.
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
SPACE Semester 1 2014/2015
SKAA 3413 Computer Programming
1d)
Muhammad Asyraf bin Masri
SX130588KAWS04
Perimeter
Pseudo Code
1.
Input number of points, n.
2.
Input coordinate for each points.
3.
Calculate all side length.
4.
Calculate perimeter.
5.
Display perimeter length.
Flow Chart
Start
Input n
Input all x,y
For each side:
S=
( xA xB ) + ( yA yB )
2
P = sum ( S )
Display P
End
4/10
SPACE Semester 1 2014/2015
SKAA 3413 Computer Programming
2)
Muhammad Asyraf bin Masri
SX130588KAWS04
Simple Beam
Pseudo Code
1.
Input span length.
2.
Input load 1 and load 2 and their location.
3.
Input distance x.
4.
Calculate reaction.
5.
Calculate maximum bending moment.
6.
Calculate bending moment at x.
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
Display M max , xmax & M x
End
5/10
SPACE Semester 1 2014/2015
SKAA 3413 Computer Programming
3)
Muhammad Asyraf bin Masri
SX130588KAWS04
Leap Year
Pseudo Code
1.
Input year.
2.
If year < 1582, repeat input year, otherwise proceed.
3.
Determine year is common or leap.
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
SPACE Semester 1 2014/2015
SKAA 3413 Computer Programming
4)
Muhammad Asyraf bin Masri
SX130588KAWS04
Average Strength
Pseudo Code
1.
Input number of sample, n.
2.
Input strength of each sample.
3.
Calculate average strength.
4.
Display average strength.
Flow Chart
Start
Input n
Input 1 to n
max min
n2
Display
End
7/10
SPACE Semester 1 2014/2015
SKAA 3413 Computer Programming
5)
Muhammad Asyraf bin Masri
SX130588KAWS04
Ball Bounces
Pseudo Code
1.
Input initial height, h greater than 10.
2.
Input coefficient of restitution, r. 0 < r < 1.
3.
Calculate bouncing height, b and sum b using geometric series until b < 10.
4.
Calculate total number of bounce and traveled distance.
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
SPACE Semester 1 2014/2015
SKAA 3413 Computer Programming
6)
Muhammad Asyraf bin Masri
SX130588KAWS04
Glulam Beam
Pseudo Code
1.
Input moment of inertia, I.
2.
Input plank thickness, t and width, b.
3.
Calculate number of layer, n.
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
SPACE Semester 1 2014/2015
SKAA 3413 Computer Programming
7)
Muhammad Asyraf bin Masri
SX130588KAWS04
Truss
Pseudo Code
1.
Input magnitude of load L1 L2 and L3.
2.
Set start point and end point of each member.
3.
Calculate length of each member.
4.
Calculate force of each member.
5.
Calculate reactions at support A and B.
6.
Display result.
Flow Chart
Start
Input L1, L2 & L3
Set start and end of members
m = [ x1 , y1 , x2 , y2 ]
Calculate length of members
L=
( x1 x2 ) + ( y1 y2 )
2
Calculate force at each joint
Fx = 0 & Fy = 0
Calculate support reactions
Rxa, Rya, Rxb, Ryb
Display:
Rxa, Rya, Rxb, Ryb
Length of each member
Force of each member
End
10/10