Yachkov

Ski trip

Jan 25th, 2021
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.71 KB | None | 0 0
  1. using System;
  2. using System.ComponentModel.DataAnnotations;
  3. using System.ComponentModel.Design;
  4. using System.Globalization;
  5. using System.Reflection;
  6. using System.Runtime.ConstrainedExecution;
  7. using System.Security.Cryptography;
  8.  
  9. namespace SomeExcercises
  10. {
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.            
  16.             double finalPrice = 0.0;
  17.             int dayOfResidence = int.Parse(Console.ReadLine());
  18.             string roomType = Console.ReadLine();
  19.             string rating = Console.ReadLine();
  20.  
  21.             switch (roomType)
  22.             {
  23.                 case "room for one person":
  24.                     if (dayOfResidence < 10 || dayOfResidence > 10 && dayOfResidence < 15 || dayOfResidence > 15)
  25.                     {
  26.                         finalPrice = (dayOfResidence - 1) * 18.00;
  27.  
  28.                     }
  29.                     break;
  30.                 case "apartment":
  31.                     if (dayOfResidence < 10)
  32.                     {
  33.                         finalPrice = (dayOfResidence - 1) * 25.00;
  34.                         finalPrice -= finalPrice * 0.30;
  35.                     }
  36.                     else if (dayOfResidence > 10 && dayOfResidence < 15)
  37.                     {
  38.                         finalPrice = (dayOfResidence - 1) * 25.00;
  39.                         finalPrice -= finalPrice * 0.35;
  40.                     }
  41.                     else
  42.                     {
  43.                         finalPrice = (dayOfResidence - 1) * 25.00;
  44.                         finalPrice -= finalPrice * 0.50;
  45.                     }
  46.                     break;
  47.                 case "president apartment":
  48.                     if (dayOfResidence < 10)
  49.                     {
  50.                         finalPrice = (dayOfResidence - 1) * 35.00;
  51.                         finalPrice -= finalPrice * 0.10;
  52.                     }
  53.                     else if (dayOfResidence > 10 && dayOfResidence < 15)
  54.                     {
  55.                         finalPrice = (dayOfResidence - 1) * 35.00;
  56.                         finalPrice -= finalPrice * 0.15;
  57.                     }
  58.                     else
  59.                     {
  60.                         finalPrice = (dayOfResidence - 1) * 35.00;
  61.                         finalPrice -= finalPrice * 0.20;
  62.                     }
  63.                     break;
  64.                    
  65.             }
  66.  
  67.             switch (rating)
  68.             {
  69.                 case "positive":
  70.                     finalPrice += finalPrice * 0.25;
  71.                     break;
  72.                 default:
  73.                     finalPrice -= finalPrice * 0.10;
  74.                     break;
  75.             }
  76.  
  77.             Console.WriteLine($"{finalPrice:f2}");
  78.  
  79.         }
  80.  
  81.     }
  82. }
  83.  
  84.  
  85.  
  86.  
Advertisement
Add Comment
Please, Sign In to add comment