ENG TECH 1PR3 Programming Principles
ENG TECH 1PR3 Programming Principles
Assignment 01
Be sure to assign all input to appropriate variables. Do NOT use the control name directly in the
calculations. Instead, assign the value of a control to a variable and use the variable in the
calculations. Assign the result of the calculations to an appropriate form control. Ensure the
forms are well-behaved. A form must contain an Exit button, sensible tabbing and alt-shortcuts
where appropriate.
This assignment comprises 2 VB applications. Create each as a separate project.
VB Application 1
Create a VB application that will perform the following tasks.
a. The user will enter the number of seconds in the textbox.
b. Store the number of seconds in a minute as a constant and use it in the calculations.
c. Store the number of seconds in an hour in a constant and use it in the calculations.
d. Store the number of seconds in a day in a constant and use it in the calculations.
e. Calculate the number of Days, hours, minutes and seconds. For instance, if the user enters
95646 seconds, the Time Calculator will display the results:
1 day, 2 hours, 34 minutes, 6 seconds
f. Display the days, hours, minutes and seconds result in a label control as shown above.
g. Add a Clear button that will clear the textbox, and the label control.
h. Validate user input for nonnumeric and seconds >= 0.
VB Application 2
Consider the integration of ( ) 0.3 2 3 5 3 2 f x x x x in the interval [0, 3] :
3
0
Sum f (x) dx . ------ (1)
The analytical solution to this problem is Sumanalytical = 16.575.
Numerically we can integrate the above function by writing the
integral in eq(1) as
Sumnumerical =
N
i
f xi x
1
( ) , ---------- (2)
where x is a user defined step size and
x
N
3 0
.
The error in the above calculation is
error = Sumanalytical - Sumnumerical ------------ (3)
Develop an application that:
(1) Solve eq(1) numerically by implementing eq(2). The application will require a user
defined step-size that satisfies 0 x 0.1.
(2) Calculate the error defined in eq(3).
(3) Display the above results.
Submitting the Lab
In order for your Lab/Assignment to be eligible for grading you must submit the following:
The code must contain your Full Name and Student ID in a comment block at the top of
each form module.
A .zip compressed file containing the entire VB.NET project to AVENUE. Use .zip
compression only (no RAR, TAR etc). If there is more than one project, create a separate
.zip file for each individual project. Be sure to add all project files and folders to the .zip
file. If the compressed file is missing files/folders such that the project will not open or
run, the lab/assignment will receive a grade of 0.
A Word .doc (or .docx) file containing:
o A cover page that includes your name, Student ID, and MAC ID
o The form code (event and other subprocedures and functions) including
programmer’s block
o Screen captures of the form showing sample input and output.
Upload the Word file and .zip file(s) separately to the appropriate assignment drop-box on
AVENUE.
Labs and assignments will not be accepted for evaluation if any of the above items are omitted
and will result in a grade of 0.
10 years ago
Purchase the answer to view it

- the-code-for-assignment01.zip