Views
1 year ago

BIS 450 DeVry Week 3 iLab 3

Moderately active (3-5

Moderately active (3-5 days/week) 1.55 False Very active (6-7 days/week) 1.725 False Extra active (sports & physical job) 1.9 False The completed list should look like the following: After you have finished adding items to the list, click OK. 9. Below the Activity Level input, insert a blank line and place the following additional controls, with a blank line between each one, setting properties as indicated: Control (ID) Text Button btnCalculate Calculate Calorie Needs Literal litResults Your completed Web form should look like the following in Design View: 10. Save the Web form. STEP 3: Add Calculate Calorie Needs Event Handler in Code-Behind File 1. Double-click the btnCalculate button to create a skeleton click event handler procedure in the code-behind file. 2. Open the BIS450 Lab3 Code Snippets.txt file that you downloaded from Doc Sharing, select and copy the section of code beginning with the comment “‘Calculate daily calorie needs”, and paste it in between the Protected Sub btnCalculate_Click(. . . ) and End Sub statements in the code-behind file. Notice that the code is incomplete. After pasting in this code, the code-behind file should look like this: 3. Based on the specifications provided by Dr. Dinewell (listed in the scenario at the top of these lab instructions), write the additional statement needed in the Else clause to calculate the BMR for men. Use the formula for women provided in the function as a model. Hint: You only need to replace the “‘TO DO:” line with the men’s BMR values. 4. Save your work so far. STEP 4: Add Input Validation 1. Return to editing the CalNeeds.aspx Web form in Design View. 2. Drag a RequiredFieldValidator control from the Validation section of the Toolbox and place it on the form just to the right of the txtHeight TextBox. Set its properties as follows to ensure that the user enters a value for height: Property Setting ControlToValidate txtHeight Display Dynamic ErrorMessage You must enter your height in inches. 3. Drag a RangeValidator control from the Validation section of the Toolbox and place it on the form to the right of the RequiredFieldValidator you added in the previous action. (It’s OK if the validators wrap onto the next line in the editing window display.) Set the RangeValidator’s properties as follows to ensure that the user enters a height value that is a type Double (that is, a decimal number,) that is in the range of 48 to 84 inches: Property Setting ControlToValidate txtHeight Display Dynamic ErrorMessage Height must be a decimal number between 48 and 84 inches. MaximumValue 84

MinimumValue 48 Type Double Here is what part of your form should look like with both validation controls in place (what you see may vary depending on the width of your editing window): 4. In a similar way, place a RequiredFieldValidator and a RangeValidator to the right of the txtWeight TextBox, and set their properties to ensure that the user enters a value for weight, and that value is a type Double (decimal number) that is between 50 pounds and 500 pounds. Compose your own reasonable error messages for these validators. 5. Place a RequiredFieldValidator and a RangeValidator to the right of the txtAge TextBox, and set their properties to ensure that the user enters a value for age, and that value is a type Integer (whole number) that is between 18 and 120. Compose your own reasonable error messages for these validators. 6. Save your work. STEP 5: Test, Capture Screenshot, and Submit 1. To test the Calorie Needs calculator, in the Solution Explorer window, right-click on CalNeeds.aspx and select View in Browser. If you experience problems viewing your page, perform the following: • In the Solution Explorer, right-click on your FTP address and select Property Pages. • Under the Start Options tab, make sure the Base URL is set to include the full HTTP address listing (example only: HTTP://bisweb.devry.edu/YourCourseFolder/YourPersonalFolder). 2. Enter some different values for the various inputs into the calculator, click Calculate Calorie Needs, and check the results. Some test values you might want to try are: Gender Height Weight Age Activity Calories Female 60 120 35 Sedentary 1553 Female 66 150 47 Lightly Active 1921 Male 72 165 24 Moderately Active 2860 Male 68 144 54 Very Active 2518 Male 76 180 32 Extra Active 3677 Here is an example of what your form should look like with one set of inputs: 3. You should also test that your input validation works correctly. Try leaving the height, weight, or age fields blank and verify that the correct error messages are displayed. Also try entering values that are too high or too low in these fields. Here is an example of what your form should look like with an invalid entry: 4. Capture a screenshot of the calculator after you click the Calculate Calorie Needs button with the following inputs, and paste it into a Word document: Gender Height Weight Age Activity Female 62 135 28 Moderately Active 5. Capture a second screen shot of the calculator after you click the Calculate Calorie Needs button with the height, weight, and age fields all blank, and paste it into the same Word document. 6. Capture a third screen shot of the calculator after you click the Calculate Calorie Needs button with the following (invalid) values for height, weight, and age, and paste it into the same Word document. Height Weight Age 42 600 50.5 7. Save the Word document containing your three screenshots as Your Name BIS450 Lab3 Screenshot.docx. (Make sure that the browser URL is visible in all your screen shots.) Submit this file to the Week 3 iLab Dropbox.

DEVRY CIS 336 Week 3 iLab 3
DEVRY MGMT 404 Week 3 iLab
DEVRY BIAM 420 Week 3 iLab NEW