Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.54 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.             int adults = int.Parse(Console.ReadLine());
  14.             int students = int.Parse(Console.ReadLine());
  15.             int nights = int.Parse(Console.ReadLine());
  16.             string transport = Console.ReadLine().ToLower();
  17.             double adultsPay = 0;
  18.             double studentsPay = 0;
  19.             double discount = 1;
  20.             if (adults + students >= 50)
  21.             {
  22.                 discount = 0.5;
  23.             }
  24.  
  25.             if (transport == "train")
  26.             {
  27.                 adultsPay = 24.99;
  28.                 studentsPay = 14.99;
  29.             }
  30.             else if (transport == "bus")
  31.             {
  32.                 adultsPay = 32.50;
  33.                 studentsPay = 28.50;
  34.             }
  35.             else if (transport == "boat")
  36.             {
  37.                 adultsPay = 42.99;
  38.                 studentsPay = 39.99;
  39.             }
  40.             else if (transport == "airplane")
  41.             {
  42.                 adultsPay = 70.00;
  43.                 studentsPay = 50.00;
  44.             }
  45.             double transportPrice = (adults * adultsPay + studentsPay * students) * discount;
  46.             double hotelPrice = 82.99 * nights;
  47.             double totalPayWithCommision = (transportPrice * 2 + hotelPrice) * 1.10;
  48.             Console.WriteLine("{0:f2}", totalPayWithCommision);
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement