Advertisement
Niicksana

Vacation

Dec 11th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.82 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 _3.Vacation
  8. {
  9.     class Vacation
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // Exam - 20 November 2016 - Morning
  14.             int olds = int.Parse(Console.ReadLine());
  15.             int students = int.Parse(Console.ReadLine());
  16.             int nights = int.Parse(Console.ReadLine());
  17.             string vehiclе = Console.ReadLine().ToLower();
  18.  
  19.             double ticketPrice = 0;
  20.             double hotelPrice = 0;
  21.  
  22.             if (vehiclе == "train")
  23.             {
  24.                 if (olds + students >= 50)
  25.                 {
  26.                     ticketPrice = ((olds * (24.99 / 2)) + (students * (14.99 / 2))) * 2;
  27.                     hotelPrice = nights * 82.99;
  28.                 }
  29.  
  30.                 else
  31.                 {
  32.                     ticketPrice = ((olds * 24.99) + (students * 14.99)) * 2;
  33.                     hotelPrice = nights * 82.99;
  34.                 }
  35.             }
  36.  
  37.             else if(vehiclе == "bus")
  38.             {
  39.                 ticketPrice = ((olds * 32.50) + (students * 28.50)) * 2;
  40.                 hotelPrice = nights * 82.99;
  41.             }
  42.  
  43.             else if (vehiclе == "boat")
  44.             {
  45.                 ticketPrice = ((olds * 42.99) + (students * 39.99)) * 2;
  46.                 hotelPrice = nights * 82.99;
  47.             }
  48.  
  49.             else if (vehiclе == "airplane")
  50.             {
  51.                 ticketPrice = ((olds * 70.00) + (students * 50.00)) * 2;
  52.                 hotelPrice = nights * 82.99;
  53.             }
  54.  
  55.             double commission = (ticketPrice + hotelPrice) * 0.10;
  56.             double totalPrice = ticketPrice + hotelPrice + commission;
  57.  
  58.             Console.WriteLine("{0:f2}", totalPrice);
  59.  
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement