BIS 450 DeVry Week 3 I Lab 3
Downloading is very simple, you can download this Course here:
Contact us at:
BIS 450 DeVry Week 3 iLab 3
BIS 450 DeVry Week 3 iLab 3
iLab 3 of 8: Daily Calorie Needs Calculator
Submit your assignment to the Dropbox located on the silver tab at the top of this page.
(See Syllabus/”Due Dates for Assignments & Exams” for due dates.)
i L A B O V E R V I E W
You have been asked to add a Daily Calorie Needs Calculator to the Healthy Eating website. This feature will determine how many calories an individual needs to consume daily to maintain his or her current body weight. If the person consumes fewer calories, he or she will lose weight; if more calories are consumed, the person will gain weight. Dr. Dinewell has provided you with the following specifications for the Daily Calorie Needs Calculator:
- Inputs: Gender, weight (pounds), height (inches), age (years), activity level
o Basal Metabolic Rate (women) = 655 + (4.35*weight) + (4.7*height) – (4.7*age)
o Basal Metabolic Rate (men) = 66 + (6.23 * weight) + (12.7*height) – (6.8*age)
o Daily calorie needs = BMR * (activity factor)
o Activity factor = 1.2 if sedentary, 1.375 if lightly active, 1.55 if moderately active, 1.725 if very active, 1.9 if extra active
- Source: http://www.bmi-calculator.net/bmr-calculator/harris-benedict-equation/
- Outputs: Daily calories needed to maintain current weight
You will create an ASP.NET Web form to accept the user inputs and display the results. Because this is a more complex calculation involving more inputs than last week’s BMI Calculator, you will need to use several different types of server controls including radio buttons and a drop-down list for this task. You will also add input validation to ensure that the form will not malfunction or give erroneous results if some input values are missing or entered incorrectly.
- Calorie Needs Calculator Web form (CalNeeds.aspx) and associated code-behind file (CalNeeds.aspx.vb) added to the Healthy Eating website on the DeVry Web server.
- Word document with three screenshots of Calorie Needs Calculator Web form displayed in browser (Your Name BIS450 Lab3 Screenshot.docx). Screen shots must show calculator test inputs and results or appropriate error messages. Screenshots must show the complete browser window, including the URL of the page.
Criteria Points %
Step 2: Create Calorie Needs Web Form (CalNeeds.aspx)
- CalNeeds.aspx created in your Web folder
- Has standard page header, navigation menu, and page footer
- Form title “Calorie Needs Calculator” in bold
- Input controls: radio buttons for male and female; textboxes for height, weight and age; drop-down list for activity level
- Button for BMI calculation
- Literal control below button for display of results 10 40%
Step 3: Add Calculate BMI Event Handler in Code-Behind File (CalNeeds.aspx.vb)
- Click event handler created for Calculate Calorie Needs button in code-behind file
- Statement added to Else clause to calculate BMR for men using correct formula
- Captures input values, calculates BMR, multiplies BMR by activity to calculate calories needed
- Displays calories needed 6 24%
Step 4: Add Input Validation (CalNeeds.aspx)
- RequiredFieldValidators added for height, weight, and age
- RangeValidator added to check height is 48-84 type Double
- RangeValidator added to check weight is 50-500 type Double
- RangeValidator added to check age is 18-120 type Integer
- Appropriate error messages displayed by all validators 6 24%
Step 5: Test, Capture Screen Shots, and Submit (Student Name BIS450 Lab3 Screenshot.docx)
- Word file submitted to Dropbox with screen shots of:
o Calculator with correct inputs (calories should be 2173)
o Calculator with all fields blank (should display all required field error messages)
o Calculator with invalid inputs (should display all range error messages) 3 12%
Total 25 100%
- Download the file BIS450 Lab3 Code Snippets.txt from Doc Sharing and save it in your working folder for this lab.
- Using the Citrix remote lab:
- Follow the login instructions located in the iLab tab in Course Home.
- Upload the file you downloaded from Doc Sharing into your BIS450Labs folder on your Citrix drive (you created this folder in Week 1).
STEP 1: Open Website on the DeVry Web Server
- Launch Microsoft Visual Studio 2010.
You must use Visual Studio 2010 in the Citrix environment.
- Pull down the File menu and select Open, then select Web Site. In the Open Web Site dialog, select FTP Site in the left column. The connection information you used in the previous lab should be displayed:
- Server: bisweb.devry.edu
- Port: 21
- Directory: coursefolder/yourname, where coursefolder = folder on the web server for your course (provided by your professor), and yourname = your first initial and last name, (for example, jsmith for student John Smith).
- Passive Mode and Anonymous Login: Both unchecked.
- Username: acadDnnnnnnnn, where Dnnnnnnnn = your DSI number.
- Password: Enter the same password as you use for Citrix iLab (must be re-entered each time).
STEP 2: Create Calorie Needs Web Form
- Add a new Web form named CalNeeds.aspx to the site. (Review last week’s iLab if you need help remembering exactly how to do this.)
- Set the Title property of the Document to Calorie Needs Calculator.
- Attach StyleSheet.css to the Web form.
- As you did when setting up the BMI Calculator Web form in last week’s iLab, open Default.htm and copy the contents of its element (in HTML, everything in between the and tags, but not the and tags themselves). Paste these contents inside the div in CalNeeds.aspx (in HTML, in between the
tags). Delete the contents of the #main div after pasting.
- Inside div#main, type Daily Calorie Needs Calculator as a heading for the form, followed by a blank line. Bold this heading.
- Type the following input prompts, one per line with a blank line between each, and add the corresponding control from the Standard section of the Toolbox after each prompt. Set the properties of each control as indicated below.
Prompt Control (ID) Text
Height (inches): TextBox txtHeight
Weight (pounds): TextBox txtWeight
Age (years): TextBox txtAge
Activity Level: DropDownList ddlActivity
- For each of the two RadioButtons, set the GroupName property to Gender. (Giving both RadioButtons the same GroupName ensures that only one can be “on” at a time.) Also, set the Checked property of the rdoFemale RadioButton to True (Female will be the default).
- Select the ddlActivity DropDownList control, click the Items property in the Properties pane, and then click on the button with three dots […] that appears. In the ListItem Collection Editor dialog, click Add. Enter Sedentary (little or no exercise) as the Text and 1.2 as the Value, and set Selected to True.
Continue clicking Add to add the following items to the list:
Text Value Selected
Lightly active (1-3 days/week) 1.375 False
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.
- 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
Your completed Web form should look like the following in Design View:
- Save the Web form.
STEP 3: Add Calculate Calorie Needs Event Handler in Code-Behind File
- Double-click the btnCalculate button to create a skeleton click event handler procedure in the code-behind file.
- 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:
- 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.
- Save your work so far.
STEP 4: Add Input Validation
- Return to editing the CalNeeds.aspx Web form in Design View.
- 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:
ErrorMessage You must enter your height in inches.
- 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:
ErrorMessage Height must be a decimal number between 48 and 84 inches.
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):
- 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.
- 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.
- Save your work.
STEP 5: Test, Capture Screenshot, and Submit
- 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).
- 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:
- 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:
- 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
- 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.
- 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
- 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.