Homework #5 - Calorie Calculator
Submit Assignment View Project
Task:
- Create a website that calculates the total of fat, carbohydrate, and protein calories. Allow the user to enter (in text boxes) the grams of fat, the grams of carbohydrates, and the grams of protein. Each gram of fat is nine calories; a gram of protein or carbohydrate is four calories.
Code:
- You MUST use a custom class
- This class must contain properties for Fat, Carbs, and Protein.
- Your class must have a function to return ItemCalories
- ItemCalories should equal Fat * 9 + Cards * 4 + Protein * 4
- Your class MUST contain one constructor to initialize the properties.
- You must have required field validators for Fat, Carbs and Protein
- You must validate the range of Fat, Carbs, and Protein between 1 and 1000
- You must have a calculate button that:
- Creates an instance of your class using the overloaded constructor
- Displays resulting output from calculation
- Displays totals on the screen
- You must have a Clear button to clear individual calculations
- Accumulate totals for number of calculations and total calories
- HINT: Use HiddenFields to store the totals in between page posts. You cannot use shared variables for this.
For Full Credit:
- Program must be well documented and controls well named according to standards.
- Data must be validated and formatted appropriately
- Results must match Runtime answers
- All items in Code section above must be completed