0% found this document useful (1 vote)
221 views9 pages

UTT Civil Engineering - CONS1006 - 45% Final Coursework Assignment

This document provides instructions for a final coursework assignment in Civil Engineering at the University of Trinidad and Tobago. It includes 4 questions on Excel skills involving loops, formulas, charts and histograms. Students must submit their answers in a single Excel workbook by the due date of November 28, 2013 following specific formatting and labeling guidelines.

Uploaded by

Phaessuh Kromah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
221 views9 pages

UTT Civil Engineering - CONS1006 - 45% Final Coursework Assignment

This document provides instructions for a final coursework assignment in Civil Engineering at the University of Trinidad and Tobago. It includes 4 questions on Excel skills involving loops, formulas, charts and histograms. Students must submit their answers in a single Excel workbook by the due date of November 28, 2013 following specific formatting and labeling guidelines.

Uploaded by

Phaessuh Kromah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

THE UNIVERSITY OF TRINIDAD AND TOBAGO

Final Coursework Assignment


CONS1006 N.E.T.D. Civil Engineering
Weighting: 45%


Due: Wed 28
th
Nov 2013

Requirements
1. To earn full credit, e-mail a PDF and the Excel workbook, with codes and answers, for each question.
2. You should be able to fit more than one exercise per sheet.
3. Make sure all codes in Excel (spreadsheet cells) and answers are clearly labeled.
4. Grading will be based on: Accuracy of the end-result, Detail of explanations given where required,
And adherence and conformance to the VBA code structure and protocols where applicable.
5. E-mail ONE Excel Workbook, with the answers for each question/exercise on separate spreadsheets,
within the single workbook.
6. All your Excel Spreadsheets and answers should be clearly labeled.
7. ONE submission per person is expected, via e-mail.
8. E-mail submission subject header should contain: Course Title, First Name, Last Name & 45A (i.e.
CONS1006 Jane Doe 45A).
9. Workbook submissions should each contain your individual First Name Initial & Last Name (i.e.
CONS1006 J. Doe).
10. The consequences for your failure to submit this assignment on time is clearly documented in your
course outline.

THE UNIVERSITY OF TRINIDAD AND TOBAGO
Computer Application and Programming
COURSE CODE :- CONS1006
N.E.T.D. Civil Engineering
2


Question 1: 10%
Loops are a fundamental part of all programming.
There are three main loops that commonly appear. They are the
The For Loop
The Do Until Loop
The Do While Loop
Within each loop VBA code is executed until a maximum number is reached or a predefined condition
is meet.
Examples of VBA Code involving loops for Excel.
The For Loop The Do Until Loop The Do While Loop
Sub LoopA()
'Fills cells A1:A56 with values of X
by looping
' Increase value of X by 1 in each
loop
'
MsgBox("What does this loop do?")
'Describe what the loop does
Dim X As Integer
For X = 1 To 56
Range("A" & X).Value = X
Next X
End Sub

Sub LoopB()
'
' Fills cells B1:B56 with the 56
background colours
'
Dim X As Integer
For X = 1 To 56
Range("B" & X).Select
With Selection.Interior
.ColorIndex = X
.Pattern = xlSolid
End With
Next X
End Sub

Sub LoopH()
'
' Loops until a condition is meet.
'
Dim Z As Integer
Z = 1
Do
Range("H" & Z).Value = Z
Z = Z + 1
Loop Until Z > 10
End Sub

Sub LoopTime_Period()
'
'Time interval or pause
'
Dim TimePeriod, Start, Finish,
TotalTime
If (MsgBox("Press Yes to pause for 3
seconds", 4)) = vbYes Then
TimePeriod = 3 ' time interval
Start = Timer ' start time.
Do Until Timer > Start +
TimePeriod
DoEvents ' Do other processes.
Loop

Finish = Timer ' Set end of time.
TotalTime = Finish - Start
'Calculate total time.
MsgBox "Time interval is " &
TotalTime & " seconds"
Sub LoopI()
'
' Loops while a condition is
true.
'
Dim Z As Integer
Z = 1
Do
Range("I" & Z).Value = Z
Z = Z + 1
Loop While Z < 10
End Sub

Sub LoopTime_Count()
'
'Counts the number of
loops per sec
'
Dim LoopTime As Double,
X As Single
X = 0
Range("J1").Value =
"Loops per sec"
StartTime = Timer

Do While Timer -
StartTime < 1
X = X + 1
Loop

Range("J2").Value = X
THE UNIVERSITY OF TRINIDAD AND TOBAGO
Computer Application and Programming
COURSE CODE :- CONS1006
N.E.T.D. Civil Engineering
3

Sub LoopC()
'
' Fills every second cell from
C1:C100 with values of X
'
Dim X As Integer
For X = 1 To 100 Step 2
Range("C" & X).Value = X
Next X
End Sub

Sub LoopD()
'
' Fills cells from D1:D100 with
values of X
' In this case X decreases by 1
'
Dim X As Integer, Row As Integer
Row = 1
For X = 100 To 0 Step -1
Range("D" & Row).Value = X
Row = Row + 1
Next X
End Sub

Sub LoopE()
'
' Fills every second cell from
E1:E100 with values of X
' In this case X decreases by 2
'
Dim X As Integer, Row As Integer
Row = 1
For X = 100 To 0 Step -2
Range("E" & Row).Value = X
Row = Row + 2
Next X
End Sub

Sub LoopF()
'
' Starts to fill cells F32:F500 with
values of X
' This will exit from the loop after
Else
End
End If
End Sub
End Sub
THE UNIVERSITY OF TRINIDAD AND TOBAGO
Computer Application and Programming
COURSE CODE :- CONS1006
N.E.T.D. Civil Engineering
4

255
Dim X As Integer
For X = 32 To 500
Range("F" & X).Value = X
If X = 255 Then
MsgBox ("I am going to exit at
255!")
Exit For
End If
Next X
End Sub

Sub LoopG_ASCII()
'
' Prints ASCII characters from 32 to
255
'
Range("G31").Value = "ASCII
Codes"
Dim X As Integer
For X = 32 To 255

Range("G" & X).Value = Chr(X)
Next X
End Sub
Student Activities.
Copy the VBA Code into an Excel Visual Basic Module
Run each module in turn. Make sure the Toolbars => View => Visual Basic box is ticked.
For each macro write a message box that describes what is happening. Include this at the
beginning of the macro. MsgBox("My message")
Write a VBA Macro using a For Next statement to produce 1000 lines of written text








THE UNIVERSITY OF TRINIDAD AND TOBAGO
Computer Application and Programming
COURSE CODE :- CONS1006
N.E.T.D. Civil Engineering
5

Question 2: 10%
Information on inventory of machine parts of a manufacturing company is displayed in Table 3. The first
column displays the part identification number; the second column presents the number of units on
hand available for the corresponding part; the third column gives the per-unit manufacturing cost of the
corresponding part; the fourth column gives the unit sales price for the corresponding part.
The company has the following simple inventory policy.
When the current stock level (i.e., the number of units on hand) of a part falls below a threshold,
called the minimum stock level, the company will order the part from its suppliers.
The order quantity (i.e., the number of units ordered) for the part plus the current stock level should
be equal to the maximum number of units that can be held in inventory, called the maximum stock
level.
The total order cost is the sum of the order costs for all parts that must be ordered.

Table 3: Inventory of Machine Parts
Item Part
Number
No. Units On
Hand
Per Unit
Manufacturing
Cost
Per Unit Price
19165 10 $1.25 $1.65
19166 46 $0.35 $0.50
19167 89 $3.15 $4.65
19168 12 $2.49 $3.60
19169 53 $2.25 $3.00
19170 6 $1.95 $2.95
19171 22 $1.55 $2.10
19172 31 $5.75 $7.45
19173 100 $3.95 $5.35
19174 19 $4.25 $5.75
19175 77 $0.75 $0.85
THE UNIVERSITY OF TRINIDAD AND TOBAGO
Computer Application and Programming
COURSE CODE :- CONS1006
N.E.T.D. Civil Engineering
6

19176 25 $1.19 $1.65
Minimum Stock Level 30
Maximum Stock Level 100

Use appropriate Excel formulas/functions to answer the following:
a) Use an Excel function to determine the greatest quantity on hand among all the parts stocked in
the inventory.
b) Use an Excel function to determine the average quantity on hand across all parts.
c) Use Excel equations to calculate the total dollar amount tied up in inventory, in terms of
manufacturing cost?
d) Use Excel equations to determine the average manufacturing cost per unit for the total
inventory on hand.
e) Use an Excel formula to determine how many parts have a unit price that is greater than $2.00.
f) Create a column to display an order quantity based on the following rules. If the quantity on
hand is less than the minimum stock level of 30, then order 100 minus the quantity on hand (to
bring the stock level up to 100 units of item). Otherwise the quantity ordered is zero. The
column should contain Excel functions to automatically calculate the order.













THE UNIVERSITY OF TRINIDAD AND TOBAGO
Computer Application and Programming
COURSE CODE :- CONS1006
N.E.T.D. Civil Engineering
7


For Question 3 & 4, use a chart/graph to answer the question, all charts must have a title with x-axis
and y-axis labeled appropriately.
Question 3: 10%
Table 4 provides information on structural defects in a random sample of automobile doors:

Table 4: Structural Defects in Automobile Doors

Type of Defect Number of Occurrences
Dents 4
Pits 6
Parts assembled out of sequence 2
Parts under trimmed 25
Missing holes/slots 10
Parts not lubricated 4
Parts out of contour 35
Parts not deburred 2

a) Construct an appropriate chart to help visualize how frequently different types of defects occur.
b) Construct an appropriate chart to display the percentage of defects of each different type with
respect to the total number of defects. Hint: what type of chart is good for showing proportions?






THE UNIVERSITY OF TRINIDAD AND TOBAGO
Computer Application and Programming
COURSE CODE :- CONS1006
N.E.T.D. Civil Engineering
8


Question 4: 5%
Table 5 shows the exam scores for a class of 30 students in the Introduction to Engineering class. The
maximum possible exam score is 100 points:
Table 5: Exam Scores for Students in Introduction to Engineering

Student No.
Exam
Score

Student No.
Exam
Score
1 87 16 65
2 68 17 35
3 25 18 72
4 65 19 74
5 95 20 56
6 71 21 79
7 76 22 93
8 67 23 47
9 82 24 46
10 67 25 79
11 90 26 96
12 64 27 72
13 71 28 66
14 45 29 50
15 78 30 75
Enter the data into Excel. Using the histogram utility in Excel, construct a 10-interval histogram
spanning the range of 0 to 100. Based on reviewing this histogram answer the following questions:
a) How many students have exam scores ranging from 71 to 80?
b) How many exam scores above 91 to 100?
c) How many exam scores of 50 or less?
THE UNIVERSITY OF TRINIDAD AND TOBAGO
Computer Application and Programming
COURSE CODE :- CONS1006
N.E.T.D. Civil Engineering
9

Question 5: 10%
An engineer has measured the displacement of a spring as a function of the applied force. Table 6
summarizes the data that have been obtained:
Table 6: Spring Displacement Measurements
Data Point No. Force (N) Displacement(
cm)
1 3.2 2.0
2 4.2 4.0
3 8.5 8.5
4 12.0 10.5
5 13.5 11.8
6 17.0 15.5

Note: By convention, the independent variable is usually plotted along the x-axis. But, in the case of
spring stiffness, force (the independent variable) is plotted along the y-axis and displacement (the
dependent variable) is plotted on the x-axis. Stiffness is defined as force required to cause a unit
displacement, slope of the line.

a) Plot the data points and determine the equation of the straight line that best fits the data
points. Display the equation and the correlation value (r
2
, R-squared) next to the graph.

b) What is the stiffness of the spring?

c) Based on the equation you developed, how much force is needed to displace the spring 6 cm?

You might also like