Advertisement
drunin89

03. Match Tickets

Nov 13th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.33 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.  
  7. namespace BiletiZaMach
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var budjet = double.Parse(Console.ReadLine());
  14.             var categoria = Console.ReadLine();
  15.             var hora = int.Parse(Console.ReadLine());
  16.             double sumaBileti = 0;
  17.             double ostavashti = 0;
  18.             if (hora >= 1 && hora <= 4)
  19.             {
  20.                 switch (categoria)
  21.                 {
  22.                     case "VIP":
  23.                         sumaBileti = hora * 499.99;
  24.                         break;
  25.                     case "Normal":
  26.                         sumaBileti = hora * 249.99;
  27.                         break;
  28.                     default:
  29.                         break;
  30.                 }
  31.                 ostavashti = (budjet * 0.25 - sumaBileti);
  32.             }
  33.             else if (hora >= 5 && hora <= 9)
  34.             {
  35.                 switch (categoria)
  36.                 {
  37.                     case "VIP":
  38.                         sumaBileti = hora * 499.99;
  39.                         break;
  40.                     case "Normal":
  41.                         sumaBileti = hora * 249.99;
  42.                         break;
  43.                     default:
  44.                         break;
  45.                 }
  46.                 ostavashti = (budjet * 0.40 - sumaBileti);
  47.             }
  48.             else if (hora >= 10 && hora <= 24)
  49.             {
  50.                 switch (categoria)
  51.                 {
  52.                     case "VIP":
  53.                         sumaBileti = hora * 499.99;
  54.                         break;
  55.                     case "Normal":
  56.                         sumaBileti = hora * 249.99;
  57.                         break;
  58.                     default:
  59.                         break;
  60.                 }
  61.                 ostavashti = (budjet * 0.50 - sumaBileti);
  62.             }
  63.             else if (hora >= 25 && hora <= 49)
  64.             {
  65.                 switch (categoria)
  66.                 {
  67.                     case "VIP":
  68.                         sumaBileti = hora * 499.99;
  69.                         break;
  70.                     case "Normal":
  71.                         sumaBileti = hora * 249.99;
  72.                         break;
  73.                     default:
  74.                         break;
  75.                 }
  76.                 ostavashti = (budjet * 0.60 - sumaBileti);
  77.             }
  78.             else if (hora >= 50)
  79.             {
  80.                 switch (categoria)
  81.                 {
  82.                     case "VIP":
  83.                         sumaBileti = hora * 499.99;
  84.                         break;
  85.                     case "Normal":
  86.                         sumaBileti = hora * 249.99;
  87.                         break;
  88.                     default:
  89.                         break;
  90.                 }
  91.                 ostavashti = (budjet * 0.75 - sumaBileti);
  92.             }
  93.             else
  94.             {
  95.             }
  96.             if (ostavashti >= 0)
  97.             {
  98.                 Console.WriteLine("Yes! You have {0:F2} leva left.", ostavashti);
  99.             }
  100.             else
  101.             {
  102.                 Console.WriteLine("Not enough money! You need {0:F2} leva.", Math.Abs(ostavashti));
  103.             }
  104.            
  105.  
  106.            
  107.  
  108.  
  109.         }
  110.     }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement