Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C# Lab Follow the steps below to calculate a user’s BMR (Basal Metabolic Rate).

ID: 3890989 • Letter: C

Question

C# Lab Follow the steps below to calculate a user’s BMR (Basal Metabolic Rate). Your basal metabolic rate is the rate at which the body uses energy while at rest to keep vital functions going, such as breathing and keeping warm. This calculation is vital to weight management, as it allows you to determine calories needed to maintain, lose, or gain weight. To determine your BMR, use the appropriate formula: Female: 655+(4.35 x weight in pounds)+(4.7 x height in inches)-(4.7 x age in years) Males: 66+(6.23x weight in pounds)+(12.7 x height in inches)-(6.8 x age in years). Create a new blank C# console application Write the simple code in Main that asks for and stores (in the appropriate data types) the following information input by the user: their name, age, weight, height and gender; you can assume/prompt that the weight should be in pounds and the height should be in inches. Go ahead and store gender in a string, for now. Based on the user input, calculate their BMR. Make sure that you calculate this conditionally, based on gender. HINT: you need ONLY ONE BMR variable! Display back to the user the information they entered plus the BMR that you calculated. For both parts, be sure to run and test your program to ensure it works as you intended. Test Data for part 2: Female, 63”, 120 lbs, age 32, BMR = 1322.7 Male, 72”, 200 lbs, age 32, BMR = 2008.8

Explanation / Answer

Hi,
here is fully executable code with comments to help you understand,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace example
{
class Program
{
static void Main(string[] args)
{
string name,gender; //Variables for storing person details
int age,height;
double weight;
double bmr=0;
//Displaying message for entering value
Console.WriteLine("Please Enter Name");
//Accepting and holding values in variables define above
name = Console.ReadLine();
Console.WriteLine("Please Enter Your Gender");
gender = Console.ReadLine();
Console.WriteLine("Please Enter age in years");
// for integers we have to convert values
age = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please Enter Your height in inches");
height = Convert.ToInt32(Console.ReadLine());
//for double also we need to convert
Console.WriteLine("Please Enter Your weight in pounds");
weight = Convert.ToDouble(Console.ReadLine());
if(gender=="female") //if female
{
  
bmr=655+(4.35 * weight)+(4.7 * height)-(4.7 * age) ;
}
else //if male
{
bmr= 66+(6.23* weight)+(12.7 * height)-(6.8 * age);
}
//Displaying Output
Console.WriteLine("Name:{0}", name);
Console.WriteLine("gender:{0}", gender);
Console.WriteLine("age:{0}", age);
Console.WriteLine("weight:{0}", weight);
Console.WriteLine("height:{0}", height);
Console.WriteLine("bmr:{0}", bmr);

}
}
}

Thumbs up if this was helpful, otherwise let me know in comments