Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# Language you will build on your program in which you collected input from your user to calculate his/her BMR. After youve calculated the BMR,

C# Language

you will build on your program in which you collected input from your user to calculate his/her BMR. After youve calculated the BMR, you will calculate the optimal number of calories to maintain their current weight.

Directions

-Open your the BMR calculator. The code is shown below if you need to make any corrections to your original work.

-In order to calculate a users daily allowance of calories to maintain their weight, you need to know their level of activity (in addition to the BMR that youve already calculated).

-Ask the user what their level of activity is. The best way to do this is to present a numbered menu to the user that contains the following options, and have them select the number that matches their activity level the best.

-Write a conditional expression that uses their input to determine the factor to multiply times BMR to calculate Daily Calories Allowed.

You don't exercise: BMR x 1.2 = Calories Allowed

You engage in light exercise one to three days a week: BMR x 1.375

You exercise moderately three to five times a week: BMR x 1.55

You exercise intensely six to seven days a week: BMR x 1.725

You exercise intensely six to seven days a week and have a physically active job: BMR x 1.9

-Make sure your conditional code is appropriate. In this case, you may want to declare a variable of type double named exerciseFactor that is assigned the value that corresponds to the users answer.

-Using the BMR and the exerciseFactor, calculate and store the users allowedCalories for the day.

-Output the allowed calories to the user.

-Once we know how many calories the user can eat to maintain their weight, we want to offer them a way to track their caloric intake and remaining calories.

-Because most people eat different numbers of meals and snacks throughout the day, well want to use a while loop to allow the user to do this. With a while loop, we allow the user to tell us when they want to stop the repetition there is no way for us to know the exact number of times the user will want to give us input. For this assignment, you may want to imagine the user has this application open all day, and enters his food as he eats.

-The structure of your loop should look something like this:

string response = YES; //initialize user response to yes

while (response == YES) //as long as the user says yes to continue, well repeat

{

Do some stuff in the loop //do some things over and over.

}

-You should be able to copy the code shown above right into your project. For the stuff that you need to do in the loop:

-Ask the user to enter the caloric value of the meal or snack they just ate. Store this in a variable.

-Reduce the caloriesAllowed value by that amount.

-Output the calories remaining to the user. NOTE: You do not need a separate variable for this! As you reduce the caloriesAllowed, it becomes calories remaining.

-Ask the user if they want to continue entering information for meals and snacks. Store this in the response variable.

-Convert the response string to upper case with the following code. This will allow us to test the user response effectively without writing our conditional as a compound expression. Likewise, ToLower() works exactly the same, in reverse. For now, test with the answer yes well cover input validation later.

response = response.ToUpper ();

-As long as our user responds to our question with the answer yes, it will continue to allow them to continue to enter calories taken in. NOTE: If the user goes below their allowed amount (like most of us will) just display that amount do not try to stop the loop base on this.

-test data to test your application.

Female, 63, 120 lbs, age 32, BMR = 1322.7, Excercise 3, DCA: 2050.18

Male, 72, 200 lbs, age 32, BMR = 2008.8, Exercise 4, DCA: 3465.18

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions