Advertisement
koksibg

Match_Tickets - Exam-17.07.2016

Jul 19th, 2016
1,003
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.01 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 Match_Tickets
  8. {
  9.     class Match_Tickets
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double Transport = 0;
  14.             double VIP = 499.99;
  15.             double Normal = 249.99;
  16.             double Budget = double.Parse(Console.ReadLine());
  17.             string Category = Console.ReadLine().ToLower();
  18.             int НumberOfPeople = int.Parse(Console.ReadLine());
  19.             if (НumberOfPeople >= 1 && НumberOfPeople < 5) Transport = 0.75 * Budget;
  20.             else if (НumberOfPeople >= 5 && НumberOfPeople < 10) Transport = 0.6 * Budget;
  21.             else if (НumberOfPeople >= 10 && НumberOfPeople < 25) Transport = 0.5 * Budget;
  22.             else if (НumberOfPeople >= 25 && НumberOfPeople < 50) Transport = 0.4 * Budget;
  23.             else if (НumberOfPeople >= 50) Transport = 0.25 * Budget;
  24.             double RemainingMoney = Budget - Transport;
  25.             double VipPrice = НumberOfPeople * VIP;
  26.             double NormalPrice = НumberOfPeople * Normal;
  27.             double VipTickets = RemainingMoney - VipPrice;
  28.             double NormalTickets = RemainingMoney - NormalPrice;
  29.             if (RemainingMoney >= VipPrice && Category == "vip")
  30.                 Console.WriteLine("Yes! You have {0:f2} leva left.", VipTickets);
  31.             else if ((RemainingMoney >= NormalPrice && RemainingMoney < VipPrice && Category == "normal") ||
  32.             (RemainingMoney >= VipPrice && Category == "normal"))
  33.                 Console.WriteLine("Yes! You have {0:f2} leva left.", NormalTickets);
  34.             if (RemainingMoney < VipPrice && Category == "vip")
  35.                 Console.WriteLine("Not enough money! You need {0:f2} leva.", VipPrice - RemainingMoney);
  36.             else if (RemainingMoney < NormalPrice && Category == "normal")
  37.                 Console.WriteLine("Not enough money! You need {0:f2} leva.", NormalPrice - RemainingMoney);
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement