Chapter 3 Projects
Chapter 3 Projects
B
c
c
c
c
t
c
c
A
P
I
P
The solid lines are steel members, and the white arrows are forces. The large up arrow (labeled P)
below each end is the pier force, pierForce, that supports one end of the bridge. The large down
arrow in the center (labeled L) is the weight of a load halfway across the bridge, centerLoad. Each
medium-sized down arrow across the bottom represents the weight of the road and bottom structural
members in one of the four sections of the bridge, roadWeight. Each small arrow represents the
weight of an above-road structural member, structuralWeight.
Each junction is identified by a bold capital letter (A, B, C, D, E, F, G, H, I), and each structural
member is identified by a unique pair of these letters. The small lower-case letters in the figure
indicate whether a particular steel member is in tension (t) or compression (c). All the bottom (roadlevel) members are in tension, all the top members are in compression (negative tension), and the
diagonal members alternate between tension (insides) and compression (outsides).
Since the bridge is stationary, there is no acceleration, and we can analyze it by noting that at each
junction, the total force upward must equal zero, and the total force to the right must equal zero. The
problem is symmetrical, so its sufficient to analyze half of the bridge. Lets start with vertical forces
and go from junction E back to junction A.
The vertical force exerted by diagonal DE on junction E is
upForceOnEbyED centerLoad/2 + roadWeight/2.
The centerLoad is divided by 2 because this load is shared by DE and EF. The roadWeight is
divided by 2 because half the weight of CE is carried by BC. DE is in tension, so its vertical force on
junction E is upward and the sign of this force is positive.
The vertical force exerted by diagonal DE on junction D is
upForceOnDbyDE -upForceOnEbyDE structuralWeight.
The negative signs indicate a reversed and downward force direction, respectively. The
structuralWeight term accounts for DEs own weight.
The vertical force exerted by the diagonal CD on junction D is
upForceOnDbyCD -upForceOnDbyDE + structuralWeight.
CD is in compression, so its vertical force on junction D is upward. The structuralWeight is
half the weight of DF plus half the weight of BD.
Continuing in this fashion, we also have:
upForceOnCbyCD -upForceOnDbyCD structuralWeight;
upForceOnCbyBC -upForceOnCbyCD + roadWeight;
upForceOnBbyBC -upForceOnCbyBC structuralWeight;
upForceOnBbyAB -upForceOnBbyBC + structuralWeight/2;
upForceOnAbyAB -upForceOnBbyAB - structuralWeight;
pierForce -upForceOnAbyAB + roadWeight/2.
Because AB is sloping, its compressive force pushes down not only on junction A. It also pushes to
the left, and this leftward horizontal force is exactly balanced by a rightward horizontal force exerted
by AC. This particular truss employs equilateral triangles, so each of its internal angles is 60 o. Either
trigonometry or the Pythagorean theorem says that the tensile force along the axis of any across-theroad diagonal pair is equal to 1/Sin(60) = 2/sqrt(3) = 1.1547 times the vertical force exerted on the
upper end of that member. Thus,
tensionAtAinAB 1.1547 * upForceOnAbyAB;
tensionAtBinBC -1.1547 * upForceOnBbyBC;
tensionAtCinCD 1.1547 * upForceOnCbyCD;
tensionAtDinDE -1.1547 * upForceOnDbyDE.
Also, the horizontal force exerted by any diagonal member is equal to half the axial force or
1/Tan(60) = 1/sqrt(3) = 0.57735 times the vertical force exerted by that member. This gives us
equations for the forces in the horizontal members:
rightForceOnAbyAC -0.57735 * upForceOnAbyAB;
rightForceOnCbyAC - rightForceOnAbyAC;
rightForceOnCbyCE - rightForceOnCbyAC + 0.57735 *
(upForceOnCbyBC
rightForceOnBbyBD
(upForceOnBbyAB
rightForceOnDbyBD
rightForceOnDbyDF
(upForceOnDbyCD
upForceOnCbyCD);
-0.57735 *
upForceOnBbyBC);
-rightForceOnBbyBD;
-rightForceOnDbyBD -0.57735 *
upForceOnDbyDE).
Since the horizontal forces are along the axes of the horizontal members, we have:
tensionAtAinAC rightForceOnAbyAC;
tensionAtCinCE rightForceOnCbyCE;
tensionAtBinBD rightForceOnBbyBD;
tensionAtDinDF rightForceOnDbyDF.
a) [after 3.16] Using initialized values:
Write a Java program that uses named constants for centerLoad, roadWeight, and
structuralWeight. Your program should calculate the value of pierForce, plus the
tension in all members of the truss. This does not involve fancy mathematics. Just evaluate the
expressions and make the assignments in the order in which they have been presented above,
using results of previous calculations for the next one. Make your program so that what appears
on your computer screen matches the following sample session. The first three lines show the
named constant values, and the subsequent lines show values that your program calculates.
Sample session:
Assumed center load in lbs: 20000
Assumed weight of one section of road in lbs: 2000
Assumed weight of structural pair in lbs: 500
Support for half of bridge = 16750 lbs.
Total tension in BD = -17464 lbs.
Total tension in DF = -31032 lbs.
Total
Total
Total
Total
tension
tension
tension
tension
in
in
in
in
AB
BC
CD
DE
=
=
=
=
-18186 lbs.
17320 lbs.
-14433 lbs.
13279 lbs.
tension
tension
tension
tension
in
in
in
in
AB
BC
CD
DE
=
=
=
=
-18186 lbs.
17320 lbs.
-14433 lbs.
13279 lbs.
int a = 5, b = 2;
double c = 3.0;
a += b;
b++;
c--;
c *= a;
System.out.println("a + b + c = " + (a + b + c));
A processor has a particular speed, clockRate. Although some instructions may require several
clock cycles to complete, a modern computer often executes more than one instruction in parallel, so
a given program on a given computer has an average instructionsPerCycle that may be
either less than or greater than unity. The ideal total execution time is:
statementExecutions x instructionsPerStatement /
(instructionsPerCycle x clockRate ).
To this ideal time, we must add whatever time it takes to fetch information not immediately available.
For each successful instruction execution, we must add time to account for the chance of not finding
something thats needed. Not finding something in the first-level cache adds:
(1 - firstCacheHitFraction) x firstCacheSwapTime.
Not finding something in the second-level cache adds:
(1 - firstCacheHitFraction) x (1 - secondCacheHitFraction) x
secondCacheSwapTime.
Not finding something in the main memory adds:
(1 - firstCacheHitFraction) x (1 - secondCacheHitFraction) x
(1 - mainMemoryHitFraction) x
[0.5 / diskSpeed + pageSize/(diskTrackLength x diskSpeed)].
Total incremental time is average incremental time multiplied by: statementExecutions x
instructionsPerStatement.
a) [after 3.17] Using initialized values:
Write a Java program that estimates the total time to run a typical computer program. Note the 12
assumed numeric values in the sample session below. Use 12 initialization statements to store
those values into 12 variables. No user input is necessary. The bottom two lines are calculated
results.
Sample session:
Assumed
Assumed
Assumed
Assumed
Assumed
Assumed
Assumed
Assumed
Assumed
Assumed
Assumed
Assumed
U-value is a measure of heat flow. The lower the U-value, the more slowly the material transfers heat in and out of
your home.
heating BTU/hr, total cooling BTU/hr, and the cooling load expressed in the nearest whole number of
tons, where one ton = 12,000 BTU/hr.2
The heating-load components are as follows:
roof load area * roof U-value * winter temperature difference
window load area * window U-value * winter temperature difference
wall load net area * wall U-value * winter temperature difference
infiltration load CFM * 1.08 * winter temperature difference
where:
winter temperature difference
winter indoor design temperature winter outdoor design temperature
net wall area building perimeter * building height window area
To provide a factor of safety and to accelerate morning warm up, multiply the total of all of the above
heating-load components by a factor of 1.3.
The cooling-load components are as follows:
roof load area * roof U-value * summer temperature difference
window load area * window U-value * summer temperature difference
wall load net area * wall U-value * summer temperature difference
infiltration temperature load CFM * 1.08 * summer temperature difference
solar load west solar heat gain * west window area
electrical load 3.416 * Watts
people temperature load 250 * number of people
infiltration humidity load CFM * 4675 * summer humidity difference
people humidity load 200 * number of people
where:
summer temperature difference
summer outdoor design temperature summer indoor design temperature
summer humidity difference
summer outdoor humidity ratio summer indoor humidity ratio
To provide a factor of safety, multiply the total of all of the above cooling-load components by a
factor of 1.1.
a) [after 3.17] Using initialized values:
Write a Java program that calculates summer and winter design loads. Use named constants for
the 14 items shown in the first 14 lines below. The bottom three lines are calculated results.
Sample session:
HVAC Load Calculation:
Assumed
Assumed
Assumed
Assumed
2
BTU = British Thermal Unit = amount of heat required to raise one pound of water by one degree Fahrenheit ( oF).
Assumed
Assumed
Assumed
Assumed
Assumed
Assumed
Assumed
Assumed
Assumed
Assumed
Sample session:
POLITICAL CAMPAIGN PLANNER
Assumed total number of registered voters: 5000
Assumed registered voters in our party: 1500
Assumed registered independent voters: 2000
Assumed number of regular voters in our party
(voting probability = 0.833): 900
Assumed number of regular independent voters
(voting probability = 0.833): 1000
Assumed average number of actual voters: 2000
Assumed
Assumed
Assumed
Assumed
expected
expected
expected
expected
fraction
fraction
fraction
fraction
of
of
of
of
Expected votes:
First pool: regular party votes = 749
Second pool: regular independent votes = 416
Third pool: occasional party votes = 48
Last pool: other votes = 33
total expected votes = 1246
votes needed = 1001
Expected Funding:
Assumed number of early $500 donors: 4
Assumed number of solicitation calls: 50
Amount available for campaign = 2250.0
Work Plan:
Call first pool assumption [yes:1, no:0]: 1
Call second pool assumption [yes:1, no:0]: 1
Call third pool assumption [yes:1, no:0]: 0
Assumed number of polling places: 2
Clerical hours = 95.0
Telephone hours = 200.0
Poll watcher hours = 20.0
Transport hours = 95.0
Overhead hours = 102.5
Total worker hours = 512.5
Enter number of workers available: 25
Hours per worker = 20
b) [after 3.23] Using inputs:
Modify the program of part A to make it accept inputs that override the initialized values. Make
your program so that what appears on your computer screen matches the following sample
session. As always, if a sample session contains italicized values, those values indicate user input.
Sample session:
POLITICAL CAMPAIGN PLANNER
Enter number of registered voters: 5000
Enter registered voters in our party: 1500
Enter registered independent voters: 2000
Enter number of regular voters in our party
(voting probability = 0.833): 900
Enter number of regular independent voters
(voting probability = 0.833): 1000
Enter average number of actual voters: 2000
Enter
Enter
Enter
Enter
expected
expected
expected
expected
fraction
fraction
fraction
fraction
of
of
of
of
Expected votes:
First pool: regular party votes = 749
Second pool: regular independent votes = 416
Third pool: occasional party votes = 48
Last pool: other votes = 33
total expected votes = 1246
votes needed = 1001
Expected Funding:
Enter number of early $500 donors: 4
Enter number of solicitation calls: 50
Amount available for campaign = 2250.0
Work Plan:
Call first pool? [yes:1, no:0]: 1
Call second pool? [yes:1, no:0]: 1
Call third pool? [yes:1, no:0]: 0
Enter number of polling places: 2
Clerical hours = 95.0
Telephone hours = 200.0
Poll watcher hours = 20.0
Transport hours = 95.0
Overhead hours = 102.5
Total worker hours = 512.5
Enter number of workers available: 25
Hours per worker = 20
9. [after 3.22] String Processing *:
Consider the following code fragment:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int a = 20;
int b;
double x = 3.5;
String s = "All";
char ch;
x += a;
x--;
a /= 4 - 1;
b = s.length();
b += 4;
s += "is well";
ch = s.charAt(b);
System.out.println("a = " + a + ", b = " + b);
System.out.println("x = " + x + "\ns = " + s);
System.out.println("ch = " + ch);
a) Trace the above pseudocode for x input of 8 and y input of 3, using the following header:
Use a separate row for each line of pseudocode.