CS 113 Lab 10 - FOR...NEXT loops

Objectives: Learn how to create and use FOR...NEXT loops.

 

What to do?

Read sections 6.3 of the textbook.

Design a VB program that calculates an ideal weight for men and women based on their height using the following formula:
For women: weight = height * 3.5 - 108
For men: weight = height * 4 - 128

The program requests a lower and upper bounds for heights and produces a table giving the ideal weight for men and women in that height range. When the command button is clicked, the program uses a FOR...NEXT loop to calculate the weights according to the formula given above. Hint: use a statement similar to the one below to produce a tabulated output:

picResult.Print "Height,in"; Tab(15); "W.Weight,lb"; Tab(30); "M.Weight,lb"

The interface of the program along with its output is shown below.

 

Design a VB program with the interface as shown above. Make sure the objects in your program are as follows:

 
Object                    Property                  Setting                       
frmWeight Caption Ideal weight for men and women
label1 Caption Please enter the lower bound for height:
txtLowerBound    
label2 Caption Please enter the upper bound for height:
txtUpperBound    
cmdCompute Caption Compute ideal weight
picResult    

 

Save your work.

 

Due date

No later than 11:55 pm on April 28, 2007.

 

What to submit

Use Blackboard Vista to submit the Visual Basic Form File with your program.