Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.34 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 ConsoleApp8
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string month = Console.ReadLine();
  14.             decimal price = 0;
  15.             decimal totalSum = 0;
  16.             int hours = int.Parse(Console.ReadLine());
  17.             int people = int.Parse(Console.ReadLine());
  18.             string time = Console.ReadLine();
  19.             switch (month)
  20.             {
  21.                 case "march":              
  22.                    
  23.                 case "april":
  24.                    
  25.                 case "may":
  26.                     price = time == "day" ? 10.50m : 8.40m;
  27.                     break;
  28.                 case "june":
  29.                 case "july":
  30.                 case "august":
  31.                     price = time == "day" ? 12.60m : 10.20m;
  32.                     break;
  33.                 default:
  34.                     break;
  35.             }
  36.  
  37.             if (people >= 4)
  38.             {
  39.                 price = price * 0.9m;
  40.             }
  41.             if (hours >= 5)
  42.             {
  43.                 price = price * 0.5m;
  44.             }
  45.             totalSum = price * people * hours;
  46.             Console.WriteLine($"Total cost of the visit: {price:f2}");
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement