grach

2016_November_20M Vacation

Dec 29th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.70 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 Vacation
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var adultsCount = double.Parse(Console.ReadLine());
  14.             var studenCount = double.Parse(Console.ReadLine());
  15.             var nights = int.Parse(Console.ReadLine()) * 82.99;
  16.             string transportType = (Console.ReadLine());
  17.  
  18.             switch (transportType)
  19.             {
  20.  
  21.                 case "train":
  22.                     if (adultsCount + studenCount >= 50)
  23.                     {
  24.                         adultsCount = (adultsCount * 24.99) * 0.5;
  25.                         studenCount = (studenCount * 14.99) * 0.5;
  26.                     }
  27.                     else
  28.                     {
  29.                         adultsCount = adultsCount * 24.99;
  30.                         studenCount = studenCount * 14.99;
  31.                     }                    
  32.                     break;
  33.  
  34.                 case "bus":
  35.                     adultsCount = adultsCount * 32.50;
  36.                     studenCount = studenCount * 28.50;
  37.                     break;
  38.  
  39.                 case "boat":
  40.                     adultsCount = adultsCount * 42.99;
  41.                     studenCount = studenCount * 39.99;
  42.                     break;
  43.                 case "airplane":
  44.                     adultsCount = adultsCount * 70.00;
  45.                     studenCount = studenCount * 50.00;
  46.                     break;
  47.             }
  48.  
  49.             Console.WriteLine($"{0.1 * (2 * (adultsCount + studenCount) + nights) + (2 * (adultsCount + studenCount) + nights):f2}");
  50.  
  51.  
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment