Advertisement
DidiMilikina

Untitled

Apr 3rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 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 _03.Vacation
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var adults = int.Parse(Console.ReadLine());
  14.             var students = int.Parse(Console.ReadLine());
  15.             var night = int.Parse(Console.ReadLine());
  16.             var typeOfTransport = Console.ReadLine();
  17.  
  18.             var adultsPrice = 0.00;
  19.             var studentsPrice = 0.00;
  20.             var allGroup = adults + students;
  21.             var priceAllGroupNight = 82.99;
  22.  
  23.             if (typeOfTransport == "train" && allGroup >= 50)
  24.             {
  25.                 adultsPrice = 24.99 * 0.5;
  26.                 studentsPrice = 14.99 * 0.5;
  27.             }
  28.             else if (typeOfTransport == "bus")
  29.             {
  30.                 adultsPrice = 32.5;
  31.                 studentsPrice = 28.5;
  32.             }
  33.             else if (typeOfTransport == "boat")
  34.             {
  35.                 adultsPrice = 42.99;
  36.                 studentsPrice = 39.99;
  37.             }
  38.             else
  39.             {
  40.                 adultsPrice = 70.00;
  41.                 studentsPrice = 50.00;
  42.             }
  43.  
  44.             var transportOneSide = adults * adultsPrice + students * studentsPrice;
  45.             var transportTwoSides = transportOneSide * 2;
  46.             var pricePerNight = night * priceAllGroupNight;
  47.             var commission = (transportTwoSides + pricePerNight) * 0.1;
  48.             var totalPrice = transportTwoSides + pricePerNight + commission;
  49.             Console.WriteLine($"{totalPrice:f2}");
  50.  
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement