KlimentHristov

01.BaiIvanAdventures

Nov 11th, 2015
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.86 KB | None | 0 0
  1. using System;
  2. class BaiIvanAdventures
  3. {
  4.     static void Main()
  5.     {
  6.         int dayOfWeek = int.Parse(Console.ReadLine());
  7.         decimal availableMoney = decimal.Parse(Console.ReadLine());
  8.         decimal desiredAmountOfAlcohol = decimal.Parse(Console.ReadLine());
  9.  
  10.         decimal boughtAlcohol = 0;
  11.         string status = " ";
  12.  
  13.         switch (dayOfWeek)
  14.         {
  15.             case 0: boughtAlcohol = availableMoney / 25m;
  16.                 break;
  17.             case 1: boughtAlcohol = availableMoney / 21m;
  18.                 break;
  19.             case 2: boughtAlcohol = availableMoney / 14m;
  20.                 break;
  21.             case 3: boughtAlcohol = availableMoney / 17m;
  22.                 break;
  23.             case 4: boughtAlcohol = availableMoney / 45m;
  24.                 break;
  25.             case 5: boughtAlcohol = availableMoney / 59m;
  26.                 break;
  27.             case 6: boughtAlcohol = availableMoney / 42m;
  28.                 break;    
  29.         }
  30.        
  31.  
  32.         if (boughtAlcohol>1.5m)
  33.         {
  34.             status = "very drunk";
  35.             Console.WriteLine("");
  36.         }
  37.         else if (boughtAlcohol >= 1.0m)
  38.         {
  39.             status = "drunk";
  40.         }
  41.         else
  42.         {
  43.             status = "sober";
  44.         }
  45.         if (desiredAmountOfAlcohol<boughtAlcohol)
  46.         {
  47.             Console.WriteLine("Bai Ivan is {0} and very happy and he shared {1:F2} l. of alcohol with his friends",status,boughtAlcohol-desiredAmountOfAlcohol);
  48.         }
  49.         else if(desiredAmountOfAlcohol==boughtAlcohol)
  50.         {
  51.             Console.WriteLine("Bai Ivan is {0} and happy. He is as drunk as he wanted",status);
  52.         }
  53.         else
  54.         {
  55.             Console.WriteLine("Bai Ivan is {0} and quite sad. He wanted to drink another {1:F2} l. of alcohol",status,desiredAmountOfAlcohol-boughtAlcohol);
  56.         }
  57.        
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment