Advertisement
Guest User

Untitled

a guest
Apr 1st, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _03.ArenaTournament
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double points = double.Parse(Console.ReadLine());
  14. string areaName = Console.ReadLine().ToLower();
  15. string dayOfWeek = Console.ReadLine().ToLower();
  16. string itemCondition = Console.ReadLine().ToLower();
  17. double discount = 0;
  18.  
  19. if (areaName == "nagrand")
  20. {
  21. if (dayOfWeek == "monday" || dayOfWeek == "wednesday")
  22. {
  23. discount = 5.0 / 100.0;
  24. }
  25. }
  26. else if (areaName == "gurubashi")
  27. {
  28. if (dayOfWeek == "thuesday" || dayOfWeek == "thursday")
  29. {
  30. discount = 10.0 / 100.0;
  31. }
  32. }
  33. else if (areaName == "dire maul")
  34. {
  35. if (dayOfWeek == "friday" || dayOfWeek == "saturday")
  36. {
  37. discount = 7.0 / 100.0;
  38. }
  39. }
  40. double priceAllItems = 0;
  41. if (itemCondition == "poor")
  42. {
  43. priceAllItems = 7000;
  44. }
  45. else if (itemCondition == "normal")
  46. {
  47. priceAllItems = 14000;
  48. }
  49. else if (itemCondition == "legendary")
  50. {
  51. priceAllItems = 21000;
  52. }
  53. priceAllItems -= priceAllItems * discount;
  54. double priceOneThing = priceAllItems / 5.0;
  55. int itemsBought = 0;
  56. while (true)
  57. {
  58. if (points - priceOneThing < 0 || itemsBought >= 5)
  59. {
  60. break;
  61. }
  62. points -= priceOneThing;
  63. itemsBought++;
  64. }
  65. Console.WriteLine("Items bought: " + itemsBought);
  66. Console.WriteLine("Arena points left: " + points);
  67. if (itemsBought >= 5)
  68. {
  69. Console.WriteLine("Success!");
  70. }
  71. else
  72. {
  73. Console.WriteLine("Failure!");
  74. }
  75. }
  76. }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement