30 likes | 239 Views
IS1102 Autumn Exam 2007.
E N D
IS1102 Autumn Exam 2007 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)
Private Sub cmdCompute_Click ‘declare the variables Dim sngCycling As Single, sngRunning AsSingle Dim sngSwimming As Single, sngPounds AsSingle picWtLoss.Cls ‘clears the picture box sngCycling = Val(txtCycle.Text) ‘assign the text… sngRunning = Val(txtRunning.Text) ‘property of the text-boxes… sngSwimming = Val(txtSwim.Text) ‘to the variables sngPounds = ((200 * sngCycling + 475 * sngRunning + 275 * sngSwimming) / 3500) picWtLoss.Print sngPounds; “pounds were lost.” End Sub