Upload
mira
View
41
Download
0
Embed Size (px)
DESCRIPTION
IS1102 Autumn Exam 2007. - PowerPoint PPT Presentation
Citation preview
The number of calories burned per hour by cycling, jogging and swimming are 200, 475
and 275 respectively. A person loses 1pound of weight for each 3500 calories burned. Write a program that allows the
user to input the numbers of hours spent at each activity and then calculate the number
of pounds worked off.
Note: Number of Pounds Lost = ((200 * [cycle hrs] + 475 * [run hrs] + 275 * [swim hrs]) / 3500)
IS1102 Autumn Exam 2007
Private Sub cmdCompute_Click‘declare the variablesDim sngCycling As Single, sngRunning As SingleDim sngSwimming As Single, sngPounds As Single
picWtLoss.Cls ‘clears the picture boxsngCycling = Val(txtCycle.Text) ‘assign the text…sngRunning = Val(txtRunning.Text) ‘property of the text-boxes…sngSwimming = Val(txtSwim.Text) ‘to the variablessngPounds = ((200 * sngCycling + 475 * sngRunning +
275 * sngSwimming) / 3500) picWtLoss.Print sngPounds; “pounds were lost.”End Sub