Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
1,297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.58 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 MatchTickets
  8. {
  9.     class MatchTickets
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double budget = double.Parse(Console.ReadLine());
  14.             string category = Console.ReadLine();
  15.             int people = int.Parse(Console.ReadLine());
  16.  
  17.             double transportPrice = 0;
  18.  
  19.             if (people >= 1 && people <= 4)
  20.             {
  21.                 transportPrice = budget * 0.75;
  22.             }
  23.             else if (people >= 5 && people <= 9)
  24.             {
  25.                 transportPrice = budget * 0.60;
  26.             }
  27.             else if (people >= 10 && people <= 24)
  28.             {
  29.                 transportPrice = budget * 0.50;
  30.             }
  31.             else if (people >= 25 && people <= 49)
  32.             {
  33.                 transportPrice = budget * 0.40;
  34.             }
  35.             else
  36.             {
  37.                 transportPrice = budget * 0.25;
  38.             }
  39.  
  40.             double moneyLeft = budget - transportPrice;
  41.             double ticket = category == "VIP" ? 499.99 : 249.99;
  42.             double moneyForTickets = ticket * people;
  43.             double left = Math.Abs(moneyLeft - moneyForTickets);
  44.  
  45.             if (moneyForTickets <= moneyLeft)
  46.             {
  47.                 Console.WriteLine("Yes! You have {0:F2} leva left.", left);
  48.             }
  49.             else
  50.             {
  51.                 Console.WriteLine("Not enough money! You need {0:F2} leva.", left);
  52.             }
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement