Advertisement
Guest User

Untitled

a guest
Jan 27th, 2018
390
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. namespace _01.Sandbox
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             string month = Console.ReadLine().ToLower();
  9.             int hours = int.Parse(Console.ReadLine());
  10.             int people = int.Parse(Console.ReadLine());
  11.             string period = Console.ReadLine().ToLower();
  12.             double price = 0;
  13.             if ((month == "january" || month == "february" || month == "march" || month == "april" || month == "may") && period == "day")
  14.             {
  15.                 price = 10.50;
  16.             }
  17.             else if ((month == "january" || month == "february" || month == "march" || month == "april" || month == "may") && period == "night")
  18.             {
  19.                 price = 8.40;
  20.             }
  21.             else if ((month == "june" || month == "july" || month == "august" || month == "september" || month == "october" || month == "november" || month == "december") && period == "day")
  22.             {
  23.                 price = 12.60;
  24.             }
  25.             else
  26.             {
  27.                 price = 10.20;
  28.             }
  29.  
  30.             if(people >= 4)
  31.             {
  32.                 price = price * 0.90;
  33.             }
  34.  
  35.             if(hours >= 5)
  36.             {
  37.                 price = price * 0.5;
  38.             }
  39.  
  40.             var totalSum = (price * people) * hours;
  41.  
  42.             Console.Write("Price per person for one hour: ");
  43.             Console.Write("{0:f2}", price);
  44.             Console.WriteLine();
  45.             Console.Write("Total cost of the visit: ");
  46.             Console.Write("{0:f2}", totalSum);
  47.             Console.WriteLine();
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement