COS120 Homework Project #4

Instructor: Larry Latour

Due date: Monday, 11/1/99


Your fourth Visual Basic homework assignment is designed to test your knowledge of user defined procedures and functions in section 2.6 of the text Fundamentals of Programming in Visual Basic 6.0 Programming, by David I. Schneider.

Part I: You are to neatly submit the answers to the even numbered examples 2-34 on pgs. 131-138.

Part II: You are to do the following two problems in Visual Basic, and follow the standard submission instructions for handing them in:

1. Exercise 36, Pg. 138: Write a program to display the data from table 2.11 (on text page 139). The occupations and numbers of people for 1994 and 2005 should be contained in the file Growth.txt. A Sub procedure, to be called four times, should read the three pieces of data for an occupation, calculate the percent change from 1994 to 2005, and display the four items. Note: The percent increase is calculated as 100 * (2005 value - 1994 value) / (1994 value).

2. Exercise 40, Pg. 140: (Important: Do this exercise twice, once with procedures for (a) - c), and the second time with functions for (a) - (c)!) In order for exercise to be beneficial to the cardiovascular system, the heart rate (number of heart beats per minute) must exceed a value called the training heart rate, THR. A person's THR can be calculated from his age and resting heart rate (pulse when first awakening) as follows:

(a) Calculate the maximum heart rate as 220 - age.

(b) Subtract the resting heart rate from the meximum heart rate.

(c) Multiply the result in step (b) by 60 percent and then add the resting heart rate.

Note: Write a program to request a person's age and resting heart rate as input and display their THR. (Test the program with an age of 20 and a resting heart rate of 70, and then determine your training heart rate.)

Submission instructions:

1. Align Controls Neatly: To align a group of controls (e.g., text boxes, buttons), hold down the CTRL key while clicking each. You will see handles around both. Select the Format menu choice to look at the choices. You can align the positions or sizes of the controls. They will be aligned to the settings of the last control selected in the group.

2. Print a text listing of your form as follows: In Visual Basic, select File/Print and check the box: Form as Text. This printout will display the properties of the controls in English.

3. Print a text listing of your program code as follows: In Visual Basic, select File/Print and check the box: Code.

4. Run the program and print each different traffic light configuration. To do this, do a screen dump (ALT-Print Screen) and Paste into WordPad (Start/Programs/Accessories/WordPad). Select File/Print in Wordpad to print your document.


Last Updated: 10/24/99