Advertisement
Guest User

Question 1

a guest
Sep 1st, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Numerics;
  7.  
  8. namespace Question1
  9. {
  10.     class Question1
  11.     {
  12.         static void Main()
  13.         {
  14.             int weight = int.Parse(Console.ReadLine());
  15.             int height = int.Parse(Console.ReadLine());
  16.             int age = int.Parse(Console.ReadLine());
  17.             string gender = Console.ReadLine();
  18.             int workouts = int.Parse(Console.ReadLine());
  19.  
  20.             double newWeight = weight / 2.2;
  21.             double newHeight = height * 2.54;
  22.  
  23.             double maleBMR = (66.5 + (13.75 * newWeight) + (5.003 * newHeight) - (6.755 * age));
  24.  
  25.             double femaleBMR = (655 + (9.563 * newWeight) + (1.850 * newHeight) - (4.676 * age));
  26.  
  27.             double DCI = 0;
  28.  
  29.             if (gender == "m")
  30.             {
  31.                 if (workouts == 0)
  32.                 {
  33.                     DCI = (maleBMR * 1.2);
  34.  
  35.                     Console.WriteLine(Math.Floor(DCI));
  36.                 }
  37.                 if (workouts > 0 && workouts < 4)
  38.                 {
  39.                     DCI = (maleBMR * 1.375);
  40.  
  41.                     Console.WriteLine(Math.Floor(DCI));
  42.                 }
  43.                 if (workouts > 3 && workouts < 7)
  44.                 {
  45.                     DCI = (maleBMR * 1.55);
  46.  
  47.                     Console.WriteLine(Math.Floor(DCI));
  48.                 }
  49.                 if (workouts > 6 && workouts < 10)
  50.                 {
  51.                     DCI = (maleBMR * 1.725);
  52.  
  53.                     Console.WriteLine(Math.Floor(DCI));
  54.                 }
  55.                 if (workouts > 9)
  56.                 {
  57.                     DCI = (maleBMR * 1.9);
  58.  
  59.                     Console.WriteLine(Math.Floor(DCI));
  60.                 }
  61.                 if (workouts < 0 )
  62.                 {
  63.                     DCI = (maleBMR * 1.2);
  64.  
  65.                     Console.WriteLine(Math.Floor(DCI));
  66.                 }
  67.             }
  68.             if (gender == "f")
  69.             {
  70.                 if (workouts == 0)
  71.                 {
  72.                     DCI = (femaleBMR * 1.2);
  73.  
  74.                     Console.WriteLine(Math.Floor(DCI));
  75.                 }
  76.                 if (workouts > 0 && workouts < 4)
  77.                 {
  78.                     DCI = (femaleBMR * 1.375);
  79.  
  80.                     Console.WriteLine(Math.Floor(DCI));
  81.                 }
  82.                 if (workouts > 3 && workouts < 7)
  83.                 {
  84.                     DCI = (femaleBMR * 1.55);
  85.  
  86.                     Console.WriteLine(Math.Floor(DCI));
  87.                 }
  88.                 if (workouts > 6 && workouts < 10)
  89.                 {
  90.                     DCI = (femaleBMR * 1.725);
  91.  
  92.                     Console.WriteLine(Math.Floor(DCI));
  93.                 }
  94.                 if (workouts > 9)
  95.                 {
  96.                     DCI = (femaleBMR * 1.9);
  97.  
  98.                     Console.WriteLine(Math.Floor(DCI));
  99.                 }
  100.                 if (workouts < 0 && femaleBMR < 0)
  101.                 {
  102.                     DCI = ((femaleBMR * 1.2) );
  103.  
  104.                     Console.WriteLine(Math.Floor(DCI));
  105.  
  106.                 }
  107.  
  108.             }
  109.  
  110.  
  111.         }
  112.     }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement