Please build an Iteration app with C# code in. Net. it should be a simple app th
ID: 3873256 • Letter: P
Question
Please build an Iteration app with C# code in. Net. it should be a simple app that would calculate calories burnt in 4 mile walking for a 150 pound weighted male or female. CalorieBurnt = [0.0215 x KPH3 - 0.1765 x KPH2 + 0.8710 x KPH + 1.4577] x WeightinKg x TimeInHours, where walking speed = KPH = kilometres per hour 4 mile in in an hour means 6.43738 km per hour. Please incorporate the command of "if...then...else" and other conditional logic in the app: the rules: we need to use "if...then...else" ;condition:if we put in how many minutes we walk, it will show how many calories burnt. If the walked minutes is less than 60 minutes and the colarie burnt is under 374 ,the user needs to do more exercise. If the walked minutes is over 59 minutes, the user does great job.
Explanation / Answer
using System;
using System.Numerics;
class CalorieCalc
{
static void main()
{
decimal weight_Pounds = decimal.Parse(Console.ReadLine());
decimal height_Inches = decimal.Parse(Console.ReadLine());
decimal ageIn = decimal.Parse(Console.ReadLine());
string genderIn = Console.ReadLine();
decimal workouts_PerWeek = decimal.Parse(Console.ReadLine());
decimal weight_Kg = (weight_Pounds / 2.2m);
decimal height_Sm = (height_Inches * 2.54m);
decimal men_BMR = 0;
decimal female_BMR = 0;
if (genderIn == "m")
{
men_BMR = (66.5m + (13.75m * weight_Kg) + (5.003m * height_Sm) - (6.755m * ageIn));
}
else if (genderIn == "f")
{
female_BMR = (655 + (9.563m * weight_Kg) + (1.850m * height_Sm) - (4.676m * ageIn));
}
else
{
Console.WriteLine("WRONG! Please enter "f" for female or "m" for men");
}
decimal menDCI = 0;
if (workoutsPerWeek <= 0)
{
menDCI = (men_BMR * 1.2m);
}
else if (workoutsPerWeek == 1 || workoutsPerWeek == 2 || workoutsPerWeek == 3)
{
menDCI = (men_BMR * 1.375m);
}
else if (workoutsPerWeek == 4 || workoutsPerWeek == 5 || workoutsPerWeek == 6)
{
menDCI = (men_BMR * 1.55m);
}
else if (workoutsPerWeek == 7 || workoutsPerWeek == 8 || workoutsPerWeek == 9)
{
menDCI = (men_BMR * 1.725m);
}
else
{
menDCI = (men_BMR * 1.9m);
}
if (genderIn == "m")
{
Console.WriteLine("{0}", Math.Floor(menDCI));
}
decimal femaleDCI = 0;
if (workoutsPerWeek <= 0)
{
femaleDCI = (female_BMR * 1.2m);
}
else if (workoutsPerWeek == 1 || workoutsPerWeek == 2 || workoutsPerWeek == 3)
{
femaleDCI = (female_BMR * 1.375m);
}
else if (workoutsPerWeek == 4 || workoutsPerWeek == 5 || workoutsPerWeek == 6)
{
femaleDCI = (female_BMR * 1.55m);
}
else if (workoutsPerWeek == 7 || workoutsPerWeek == 8 || workoutsPerWeek == 9)
{
femaleDCI = (female_BMR * 1.725m);
}
else
{
femaleDCI = (female_BMR * 1.9m);
}
if (genderIn == "f")
{
Console.WriteLine("{0}", Math.Floor(femaleDCI));
}
}
}