ralirp

Untitled

Feb 3rd, 2017
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.93 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 vacantion
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.  
  13.         {
  14.             var old = int.Parse(Console.ReadLine());
  15.             var junior = int.Parse(Console.ReadLine());
  16.             var nights = int.Parse(Console.ReadLine());
  17.             var transport = Console.ReadLine();
  18.             var oldprice = 0.00;
  19.             var juniorprice = 0.00;
  20.             var allgroup = old + junior;
  21.             var priceallgroupnight = 82.99;
  22.  
  23.             switch (transport)
  24.             {
  25.                 case "train":
  26.  
  27.                     if (allgroup >= 50)
  28.                     {
  29.                         oldprice = 24.99 * 0.50;
  30.                         juniorprice = 14.99 * 0.50;
  31.                     }
  32.                     else
  33.                     {
  34.                         oldprice = 24.99;
  35.                         juniorprice = 14.99;
  36.                     }
  37.  
  38.                     break;
  39.  
  40.                 case "bus":
  41.  
  42.                     oldprice = 32.50;
  43.                     juniorprice = 28.50;
  44.  
  45.                     break;
  46.  
  47.                 case "boat":
  48.  
  49.                     oldprice = 42.99;
  50.                     juniorprice = 39.99;
  51.  
  52.                     break;
  53.  
  54.                 case "airplane":
  55.  
  56.                     oldprice = 70.00;
  57.                     juniorprice = 50.00;
  58.  
  59.                     break;
  60.  
  61.  
  62.             }
  63.  
  64.             var transportoneside = oldprice * oldprice + junior * juniorprice;
  65.  
  66.             var transporttwoside = transportoneside * 2;
  67.             var pricepernight = nights * priceallgroupnight;
  68.             var komisionna = (transporttwoside + pricepernight) * 0.10;
  69.             var allsum = transporttwoside + pricepernight + komisionna;
  70.  
  71.             Console.WriteLine("{0:F2}", allsum);
  72.             Console.ReadLine();
  73.  
  74.         }
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment