fbinnzhivko

01.01 Daily Calorie Intake

Apr 15th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.58 KB | None | 0 0
  1. using System;
  2.  class DailyCalorieIntake
  3.     {
  4.         static void Main()
  5.         {
  6.             int weightInPounds = int.Parse(Console.ReadLine());
  7.             int heightInInches = int.Parse(Console.ReadLine());
  8.             int age = int.Parse(Console.ReadLine());
  9.             char gender = char.Parse(Console.ReadLine());
  10.             int workouts = int.Parse(Console.ReadLine());
  11.  
  12.             double weightInKilograms = weightInPounds / 2.2d;
  13.             double heightInCentimeters = heightInInches * 2.54d;
  14.  
  15.             double menBmr = 66.5d + (13.75d * weightInKilograms) + (5.003d * heightInCentimeters) - (6.755d * age);
  16.             double womenBmr = 655 + (9.563d * weightInKilograms) + (1.850d * heightInCentimeters) - (4.676 * age);
  17.  
  18.             double dciConstant;
  19.             if (workouts <= 0)
  20.             {
  21.                 dciConstant = 1.2d;
  22.             }
  23.             else if (workouts >= 1 && workouts <= 3)
  24.             {
  25.                 dciConstant = 1.375d;
  26.             }
  27.             else if (workouts >= 4 && workouts <= 6)
  28.             {
  29.                 dciConstant = 1.55d;
  30.             }
  31.             else if (workouts >= 7 && workouts <= 9)
  32.             {
  33.                 dciConstant = 1.725d;
  34.             }
  35.             else
  36.             {
  37.                 dciConstant = 1.9d;
  38.             }
  39.  
  40.             if (gender == 'm')
  41.             {
  42.                 Console.WriteLine(Math.Floor(menBmr * dciConstant));
  43.             }
  44.             else
  45.             {
  46.                 Console.WriteLine(Math.Floor(womenBmr * dciConstant));
  47.             }
  48.         }
  49.     }
Add Comment
Please, Sign In to add comment