Advertisement
fbinnzhivko

Match Tickets

Jul 18th, 2016
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 KB | None | 0 0
  1. using System;
  2. class Program
  3.     {
  4.         static void Main()
  5.         {
  6.             decimal budjet = decimal.Parse(Console.ReadLine());
  7.             string type = Console.ReadLine().ToLower();
  8.             int n = int.Parse(Console.ReadLine());
  9.  
  10.             decimal moneyy = 0;
  11.             decimal koef = 0;
  12.  
  13.             if (type == "normal")
  14.             {
  15.                 moneyy = 249.99M;
  16.             }
  17.             else if (type == "vip")
  18.             {
  19.                 moneyy = 499.99M;
  20.             }
  21.             if (n >= 1 && n <= 4)
  22.             {
  23.                 koef = (decimal)0.75;
  24.             }
  25.             else if (n >= 5 && n <= 9)
  26.             {
  27.                 koef = (decimal)0.60;
  28.             }
  29.             else if (n >= 10 && n <= 24)
  30.             {
  31.                 koef = (decimal)0.50;
  32.             }
  33.             else if (n >= 25 && n <= 49)
  34.             {
  35.                 koef = (decimal)0.40;
  36.             }
  37.             else if (n >= 50)
  38.             {
  39.                 koef = (decimal)0.25;
  40.             }
  41.             decimal dasdas = budjet - (koef * budjet);
  42.             if (moneyy * n <= dasdas)
  43.             {
  44.                 Console.WriteLine("Yes! You have {0:f2} leva left.", dasdas - moneyy * n);
  45.             }
  46.             else
  47.             {
  48.                 Console.WriteLine("Not enough money! You need {0:f2} leva.", moneyy * n - dasdas);
  49.             }
  50.         }
  51.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement