Advertisement
momopetrov

DailyCalorie

Dec 14th, 2015
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.10 KB | None | 0 0
  1. using System;
  2.  
  3. class dailyCalorie
  4. {
  5.     static void Main()
  6.     {
  7.         int lbs = int.Parse(Console.ReadLine());
  8.         int heightInInches = int.Parse(Console.ReadLine());
  9.         int age = int.Parse(Console.ReadLine());
  10.         char gender = char.Parse(Console.ReadLine());
  11.         int workoutsPerWeek = int.Parse(Console.ReadLine());
  12.  
  13.         double cm = heightInInches * 2.54;
  14.         double kg = lbs / 2.2;
  15.  
  16.         double menBmr = 66.5 + (13.75 * kg) + (5.003 * cm) - (6.755 * age);
  17.         double womenBmr = 655 + (9.563 * kg) + (1.850 * cm) - (4.676 * age);
  18.  
  19.         if (gender == 'm')
  20.         {
  21.             if (workoutsPerWeek <= 0)
  22.             {
  23.                 Console.WriteLine(Math.Floor(menBmr * 1.2));
  24.             }
  25.             else if (workoutsPerWeek >= 1 && workoutsPerWeek <= 3)
  26.             {
  27.                 Console.WriteLine(Math.Floor(menBmr * 1.375));
  28.             }
  29.             else if (workoutsPerWeek >= 4 && workoutsPerWeek <= 6)
  30.             {
  31.                 Console.WriteLine(Math.Floor(menBmr * 1.55));
  32.             }
  33.             else if (workoutsPerWeek >= 7 && workoutsPerWeek <= 9)
  34.             {
  35.                 Console.WriteLine(Math.Floor(menBmr * 1.725));
  36.             }
  37.             else
  38.             {
  39.                 Console.WriteLine(Math.Floor(menBmr * 1.9));
  40.             }
  41.         }
  42.  
  43.  
  44.         else
  45.         {
  46.             if (workoutsPerWeek <= 0)
  47.             {
  48.                 Console.WriteLine(Math.Floor(womenBmr * 1.2));
  49.             }
  50.             else if (workoutsPerWeek >= 1 && workoutsPerWeek <= 3)
  51.             {
  52.                 Console.WriteLine(Math.Floor(womenBmr * 1.375));
  53.             }
  54.             else if (workoutsPerWeek >= 4 && workoutsPerWeek <= 6)
  55.             {
  56.                 Console.WriteLine(Math.Floor(womenBmr * 1.55d));
  57.             }
  58.             else if (workoutsPerWeek >= 7 && workoutsPerWeek <= 9)
  59.             {
  60.                 Console.WriteLine(Math.Floor(womenBmr * 1.725));
  61.             }
  62.             else
  63.             {
  64.                 Console.WriteLine(Math.Floor(womenBmr * 1.9));
  65.             }
  66.         }
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement