Aliendreamer

computer hall programing basics

Sep 7th, 2018
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.28 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5.     using System.Collections.Generic;
  6.  
  7.     class Program
  8.     {
  9.        
  10.         static void Main(string[] args)
  11.         {
  12.  
  13.             string month = Console.ReadLine();
  14.             int hours = int.Parse(Console.ReadLine());
  15.             int people = int.Parse(Console.ReadLine());
  16.             string dayTime = Console.ReadLine();
  17.             decimal price = 0.00m;
  18.             decimal totalSum = 0.00m;
  19.  
  20.             switch (month)
  21.             {
  22.                 case "march":
  23.                 case "april":
  24.                 case "may":
  25.  
  26.                     price = dayTime == "day" ? 10.50m : 8.40m;
  27.  
  28.                     break;
  29.  
  30.                 case "june":
  31.                 case "july":
  32.                 case "august":
  33.  
  34.                     price = dayTime == "day" ? 12.60m : 10.20m;
  35.  
  36.                     break;
  37.             }
  38.  
  39.             if (people >= 4)
  40.             {
  41.                 price *= 0.9m;
  42.             }
  43.  
  44.             if (hours >= 5)
  45.             {
  46.                 price *= 0.5m;
  47.             }
  48.  
  49.             totalSum = price * people*hours;
  50.  
  51.             Console.WriteLine($"Price per person for one hour: {price:f2}");
  52.             Console.WriteLine($"Total cost of the visit: {totalSum:f2}");
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment