Anne
Dawson: CSCI110A_HW3_FA04.htm
Last
updated: Friday 22nd October 2004, 8:29 PT
This
document is subject to change without notice.
Please
report any errors or omissions in this document:
adawson@coquitlamcollege.com
Special instructions:
For this assignment you must work
alone.
See schedule for due date.
Homework
3
Specification: Weather Balloons Calculations
Step 1
Study the following:
Weather balloons are used to gather temperature and pressure
data at various altitudes in the atmosphere. The balloon rises because the
density of the helium gas in the balloon is less than the density of the
surrounding air outside the balloon. As the balloon rises, the surrounding air
becomes less dense, and thus the balloon’s ascent slows until it reaches a
point of equilibrium (balance). During the day, sunlight warms the helium
trapped inside the balloon, which causes the helium to expand and become less
dense and the balloon to rise higher. During the night however, the helium in
the balloon cools and becomes more dense, causing the balloon to descend to a
lower altitude. The next day, the sun heats the helium again and the balloon
rises. Over time, this process generates a set of altitude measurements that
can be approximated with a polynomial equation.
Assume that the following polynomial represents the altitude or
height in meters during the first 48 hours following the launch of a weather
balloon:
alt(t)
= 20.12t4 + 12t3 – 380t2
+ 4100t + 220,
where the units of t are hours. The corresponding
polynomial model for the velocity in meters per hour of the weather balloon is
as follows:
v(t)
= -0.48 t3 + 36 t2 – 760t + 4100
Print a table of the altitude and the velocity for this weather balloon using units of meters and meters/second. Let the user enter the start time, increment in time between lines of the table, and ending time, where all the time values must be less than 48 hours. In addition to printing the table, also print the peak altitude and its corresponding time.
Example: Assume
that the starting time is 0 hours, the time increment is 1 hour, and the ending
time is 5 hours. To obtain the correct units, we need to divide the velocity
value in metres/hour by 3600 in order to get metres/second. Using a calculator, we can then compute
the following values:
Time Altitude (m) Velocity (m/s)
0 220.00
1.14
1 3972.12
0.94
2 7317.92
0.76
3 11053.72
0.59
4 16458.72
0.45
5 25295.00
0.32
We can also determine the maximum altitude for this table, which
is 25295.00 metres which occurred at 5 hours.
Step 2
Design an algorithm (the steps to solve the problem). The
following web page will help you design your algorithm and pseudocode:
http://www.coquitlamcollege.com/adawson/Pseudocode.htm
Step 3
Development the pseudocode from your algorithm.
The following web page will help you design your algorithm and
pseudocode:
http://www.coquitlamcollege.com/adawson/Pseudocode.htm
Step 4
Using your pseudocode as a guide, implement your program in the
VB language.
Your program should start with a comment block that contains the
following information:
' File: HW3.frm (HW3.vbp)
' Purpose:
Altitude Calculations
' Programmer: [write your name here]
' Course: CSCI110A
' Date: [write the date name here]
' Algorithm:
' Pseudocode:
' Test data:
Please note: any statements in a VB program that start with the
' symbol are known as comments. Comments are ignored when the program runs, but
are useful when we read a program, because they supply information about
the program. They are always used
at the top of a program to supply information about the purpose of a program,
its file name, the programmer etc, as shown above. They are also used in the
body of a program to explain parts of the program which may be hard to
understand. Example programs in this course will demonstrate the correct use of
comments. You are expected to supply the above set of comments (updated
appropriately) for all of your lab and homework programming assignments.
Step 5
Test your program by running supplying
your own test data. You should test your program with at least 3 sets of test
data. Show your test data and results in comments at the top of your program.
Step 6
On the due date, you should save your
homework files (HW3.vbp and HW3.frm) and any algorithm and pseudocode files to
your folder on the network in:
CSCI110A\Week09\HW3
Assignment Presentations : In week 9 class 1, a random selection of lab assignment programs will
be presented to the CSCI110A group.
Program
points will be based on the following marking scheme:
Marking
Scheme
Student
Name:
Lab
code:
CSCI110A - Homework 3 - Fall 2004
|
Category |
Points |
Description |
|
Algorithm |
10 |
An informal description of the
steps that must be taken to solve the problem. |
|
Pseudocode |
10 |
A formal description of the
steps that must be taken to solve the problem. |
|
Comments |
10 |
The program should be commented as specified
in this document. |
|
Style |
10 |
The source code should use meaningful variable
names (identifiers) and is indented (spaced out) correctly. |
|
Design |
10 |
Appropriate data types are used. |
|
Modularity |
10 |
The program has
appropriate modularity |
|
GUI Output |
10 |
Screen prompts and outputs (user interface)
should be user-friendly. |
|
Correctness |
10 |
The program compiles with 0 errors and outputs
correct results. |
|
Completeness |
10 |
The program should be complete. |
|
Test |
10 |
Comments in the code explain how the code was
tested. |