Valantina

Movie_Destination

Jun 18th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.06 KB | None | 0 0
  1. using System;
  2. namespace _03.Movie_Destination
  3. {
  4.     class P03_MovieDestination
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             double budget = double.Parse(Console.ReadLine());
  9.             string destination = Console.ReadLine(); // "Dubai", "Sofia" ΠΈ "London"
  10.             string season = Console.ReadLine(); // "Summer" ΠΈ "Winter"
  11.             int days = int.Parse(Console.ReadLine());
  12.  
  13.             double pricePerDay = 0;
  14.             switch (destination)
  15.             {
  16.                 case "Dubai":
  17.                     switch (season)
  18.                     {
  19.                         case "Summer": pricePerDay = 40000;  break;
  20.                         case "Winter": pricePerDay = 45000; break;
  21.                     }
  22.                     break;
  23.                 case "Sofia":
  24.                     switch (season)
  25.                     {
  26.                         case "Summer": pricePerDay = 12500;  break;
  27.                         case "Winter": pricePerDay = 17000; break;
  28.                     }
  29.                     break;
  30.                 case "London":
  31.                     switch (season)
  32.                     {
  33.                         case "Summer": pricePerDay = 20250; break;
  34.                         case "Winter": pricePerDay = 24000;  break;
  35.                     }
  36.                     break;
  37.  
  38.             }
  39.  
  40.             double totalPrice = pricePerDay * days;
  41.  
  42.             if(destination == "Dubai")
  43.             {
  44.                 totalPrice = totalPrice * 0.7;
  45.             }
  46.             else if(destination == "Sofia")
  47.             {
  48.                 totalPrice = totalPrice * 1.25;
  49.  
  50.             }
  51.  
  52.             if(budget >= totalPrice)
  53.             {
  54.                 double leftMoney = budget - totalPrice;
  55.                 Console.WriteLine($"The budget for the movie is enough! We have {leftMoney:F2} leva left!");
  56.             }
  57.             else
  58.             {
  59.                 double needMoney = totalPrice - budget;
  60.                 Console.WriteLine($"The director needs {needMoney:F2} leva more!");
  61.             }
  62.         }
  63.     }
  64. }
Add Comment
Please, Sign In to add comment