Advertisement
fbinnzhivko

Untitled

Apr 1st, 2018
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.88 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         double points = double.Parse(Console.ReadLine());
  7.         string areaName = Console.ReadLine();
  8.         string dayOfWeek = Console.ReadLine();
  9.         string itemCondition = Console.ReadLine();
  10.         double discount = 0;
  11.  
  12.         if (areaName == "Nagrand")
  13.         {
  14.             if (dayOfWeek == "Monday" || dayOfWeek == "Wednesday")
  15.             {
  16.                 discount = 5.0 / 100.0;
  17.             }
  18.         }
  19.         else if (areaName == "Gurubashi")
  20.         {
  21.             if (dayOfWeek == "Tuesday" || dayOfWeek == "Thursday")
  22.             {
  23.                 discount = 10.0 / 100.0;
  24.             }
  25.         }
  26.         else if (areaName == "Dire Maul")
  27.         {
  28.             if (dayOfWeek == "Friday" || dayOfWeek == "Saturday")
  29.             {
  30.                 discount = 7.0 / 100.0;
  31.             }
  32.         }
  33.         double priceAllItems = 0;
  34.         if (itemCondition == "Poor")
  35.         {
  36.             priceAllItems = 7000;
  37.         }
  38.         else if (itemCondition == "Normal")
  39.         {
  40.             priceAllItems = 14000;
  41.         }
  42.         else if (itemCondition == "Legendary")
  43.         {
  44.             priceAllItems = 21000;
  45.         }
  46.  
  47.         priceAllItems -=  priceAllItems * discount;
  48.         double priceOneThing = priceAllItems / 5;
  49.         int itemsBought = 0;
  50.  
  51.         while (true)
  52.         {
  53.             if (points - priceOneThing < 0 || itemsBought >= 5)
  54.             {
  55.                 break;
  56.             }
  57.             points -= priceOneThing;
  58.             itemsBought++;
  59.         }
  60.  
  61.         Console.WriteLine("Items bought: " + itemsBought);
  62.         Console.WriteLine("Arena points left: " + points);
  63.  
  64.         if (itemsBought >= 5)
  65.         {
  66.             Console.WriteLine("Success!");
  67.         }
  68.         else
  69.         {
  70.             Console.WriteLine("Failure!");
  71.         }
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement