Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _01.Daily_Calorie_Intake
- {
- class Daily_Calorie_Intake
- {
- static void Main(string[] args)
- {
- //Women: BMR = 655 + (9.563 x weight in kg) +(1.850 x height in cm) – (4.676 x age in years)
- //1. W – weight in pounds (lbs.)
- decimal weightInPounds = decimal.Parse(Console.ReadLine());
- //2. H – height in inches
- decimal heightInInches = decimal.Parse(Console.ReadLine());
- //3. A – age
- decimal age = decimal.Parse(Console.ReadLine());
- //4. G – gender
- string gender = Console.ReadLine().ToLower();
- //5. E – workouts per week
- decimal workoutsPerWeek = decimal.Parse(Console.ReadLine());
- decimal weightInkg = weightInPounds / 2.20M;
- decimal heightInCm = heightInInches * 2.54M;
- decimal bmrMen = 0.0M;
- decimal bmrWomen = 0.0M;
- //No workouts DCI = BMR * 1.2
- //1–3 workouts per week DCI = BMR * 1.375
- //4–6 workouts per week DCI = BMR * 1.55
- //7–9 workouts per week DCI = BMR * 1.725
- //Extra heavy workouts DCI = BMR * 1.9
- decimal dci = 0.0M;
- switch (gender)
- {
- //Men: BMR = 66.5 + (13.75 x weight in kg) + (5.003 x height in cm) – (6.755 x age in years)
- case "m": bmrMen= 66.5M + (13.75M * weightInkg) + (5.003M * heightInCm) - (6.755M * age);
- if (workoutsPerWeek == 0)
- {
- dci = Math.Floor(bmrMen * 1.2M);
- Console.WriteLine(dci);
- }
- else if (workoutsPerWeek >= 1M && workoutsPerWeek<= 3M)
- {
- dci = Math.Floor(bmrMen * 1.375M);
- Console.WriteLine(dci);
- }
- else if (workoutsPerWeek >= 4M && workoutsPerWeek<= 6M)
- {
- dci = Math.Floor(bmrMen * 1.55M);
- Console.WriteLine(dci);
- }
- else if (workoutsPerWeek >= 7M && workoutsPerWeek <= 9M)
- {
- dci = Math.Floor(bmrMen * 1.725M);
- Console.WriteLine(dci);
- }
- else
- {
- dci = Math.Floor(bmrMen * 1.9M);
- Console.WriteLine(dci);
- }
- break;
- //Women: BMR = 655 + (9.563 x weight in kg) + (1.850 x height in cm) – (4.676 x age in years)
- case "f":
- bmrWomen = 655M + (9.563M * weightInkg) + (1.850M * heightInCm) - (4.676M * age);
- if (workoutsPerWeek == 0M)
- {
- dci = Math.Floor(bmrWomen * 1.2M);
- Console.WriteLine(dci);
- }
- else if (workoutsPerWeek >= 1M && workoutsPerWeek <= 3M)
- {
- dci = Math.Floor(bmrWomen * 1.375M);
- Console.WriteLine(dci);
- }
- else if (workoutsPerWeek >= 4M && workoutsPerWeek <= 6M)
- {
- dci = Math.Floor(bmrWomen * 1.55M);
- Console.WriteLine(dci);
- }
- else if (workoutsPerWeek >= 7M && workoutsPerWeek <= 9M)
- {
- dci = Math.Floor(bmrWomen * 1.725M);
- Console.WriteLine(dci);
- }
- else
- {
- dci = Math.Floor(bmrWomen * 1.9M);
- Console.WriteLine(dci);
- }
- break;
- default:
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement