Advertisement
desito07

03. Vacation

Jan 16th, 2023
1,173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.13 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Intro_and_Basic_Syntax
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int count = int.Parse(Console.ReadLine());
  10.             string people = Console.ReadLine();
  11.             string day = Console.ReadLine();
  12.  
  13.             double price = 0;
  14.  
  15.             if (day == "Friday")
  16.             {
  17.                 if (people == "Students")
  18.                 {
  19.                     price = count * 8.45;
  20.                 }
  21.                 else if (people == "Business")
  22.                 {
  23.                     price = count * 10.90;
  24.                 }
  25.                 else if (people == "Regular")
  26.                 {
  27.                     price = count * 15;
  28.                 }
  29.             }
  30.             else if (day == "Saturday")
  31.             {
  32.                 if (people == "Students")
  33.                 {
  34.                     price = count * 9.80;
  35.                 }
  36.                 else if (people == "Business")
  37.                 {
  38.                     price = count * 15.60;
  39.                 }
  40.                 else if (people == "Regular")
  41.                 {
  42.                     price = count * 20;
  43.                 }
  44.             }
  45.             else if (day == "Sunday")
  46.             {
  47.                 if (people == "Students")
  48.                 {
  49.                     price = count * 10.46;
  50.                 }
  51.                 else if (people == "Business")
  52.                 {
  53.                     price = count * 16;
  54.                 }
  55.                 else if (people == "Regular")
  56.                 {
  57.                     price = count * 22.50;
  58.                 }
  59.             }
  60.  
  61.             if (people == "Students" && count >= 30)
  62.                 {
  63.                     price -= price * 0.15;
  64.                 }
  65.             else if (people == "Business" && count >= 100)
  66.                 {
  67.                     price = 0;
  68.                 }
  69.             else if (people == "Regular" && count >= 10 && count <= 20)
  70.                 {
  71.                     price -= price * 0.05;
  72.                 }
  73.             Console.Write($"Total price: {price:f2}");
  74.            
  75.         }
  76.     }
  77. }
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement