' Mr. Minich Name - ' Period 1 ' Ch 3 Worksheet #2 ' 9/14/2000 ' Purpose - This program demonstrates the use of variables and declaration statements.
Option Explicit Private Sub Form_Activate()
' declaration statements ******************** Dim intBoxWidth As Integer Dim intBoxLength As Integer Dim intBoxHeight As Integer Dim sngBoxVolume As Single Dim sngCircleRadius As Single Dim sngCircleArea As Single Const sngPI As Single = 3.14 intBoxWidth = 4
intBoxLength = 6 intBoxHeight = 2 sngBoxVolume = intBoxWidth * intBoxLength * intBoxHeight ' computing volume of box sngCircleRadius = 4.2 sngCircleArea = sngPI * sngCircleRadius * sngCircleRadius ' computing area of circle ' displaying the output ********************** frmMain.Print "Welcome to the Box & Circle Computer Program" frmMain.Print frmMain.Print "The volume of the box is " & sngBoxVolume frmMain.Print frmMain.Print "The area of the circle is " & sngCircleArea End Sub ' 1. What displays as the final output on the screen? Draw a box on the back side ' of this worksheet and show the output as carefully as possible. ' 2. Fill in appropriate inline comments with the variable declarations above. ' 3. Suggest another legal & conventional variable name that could have been used ' instead of sngCircleRadius. (still use the sng prefix though)
' 4. Draw a circle around the second assignment statement in the program. ' 5. Draw a rectangle around the first variable declaration statement. ' 6. Label and draw an arrow pointing to the first reference to an object. ' 7. How many different variable data types are used in this program. ' 8. Circle one: True or False - This program uses a String variable. ' 9. On a piece of lined paper, write a complete program that calculates the area ' of rectangle that is 3.2 cm by 6.7 cm. Make sure that your program uses ' variables with legal & conventional variable names. Use appropriate ' data type(s). Make sure that the program prints out an appropriate output ' message along with the answer. Include explanatory comment statements as well. ' 10. Show the intermediate values of the following variables. Use a calculator if necessary. ' intBoxWidth intBoxLength intBoxHeight sngBoxVolume sngCircleRadius sngCircleArea ' ----------- ------------ ------------ ------------ --------------- -------------