Advertisement
bacco

Аквапарк; Aquapark

Feb 6th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.03 KB | None | 0 0
  1. using System;
  2.  
  3. namespace tESt
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var month = Console.ReadLine().ToLower();
  10.  
  11.             var hours = int.Parse(Console.ReadLine());
  12.             var groupNumber = int.Parse(Console.ReadLine());
  13.             var timeDay = Console.ReadLine().ToLower(); //"day" , "night
  14.  
  15.             double price = 0;
  16.  
  17.  
  18.             if (timeDay == "day")
  19.             {
  20.                 if (month == "march" || month == "april" || month == "may")
  21.                 {
  22.                     price =  10.50;  // day March - May
  23.                 }
  24.                 else if (month == "june" || month == "july"  || month == "august")
  25.                 {
  26.                     price =  12.60;  // day June - August
  27.                 }
  28.                 else
  29.                 {
  30.                     Console.WriteLine("ERROR");
  31.                 }
  32.             }
  33.             else
  34.             {
  35.                 if (month == "march" || month == "april" || month == "may")
  36.                 {
  37.                     price =  8.40;  // night March - May
  38.                 }
  39.                 else if (month == "june" || month == "july" || month == "august")
  40.                 {
  41.                     price =  10.20;  // night June - August
  42.                 }
  43.                 else
  44.                 {
  45.                     Console.WriteLine("ERROR");
  46.                 }
  47.             }
  48.  
  49.             var totalPrice = price * hours * groupNumber;
  50.  
  51.             if (groupNumber >= 4)
  52.             {
  53.                 totalPrice = totalPrice - (totalPrice * 0.10); // -10%
  54.                 price = price - (price * 0.10); // -10%
  55.  
  56.             }
  57.             if (hours >= 5)
  58.             {
  59.                 totalPrice = totalPrice - (totalPrice * 0.50); // -50%
  60.                 price = price - (price * 0.50); // -50%
  61.             }
  62.             Console.WriteLine($"Price per person for one hour: {price:f2}");  // per person
  63.             Console.WriteLine($"Total cost of the visit: {totalPrice:f2}");
  64.         }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement