Advertisement
Guest User

Untitled

a guest
Jan 28th, 2019
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 KB | None | 0 0
  1. using System;
  2.  
  3. namespace GameStore
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double money = double.Parse(Console.ReadLine());
  10. double leftMoney = money;
  11. while (true)
  12. {
  13. if (money == 0)
  14. {
  15. Console.WriteLine("Out of money!");
  16.  
  17. break;
  18. }
  19. string currentGame = Console.ReadLine();
  20.  
  21. if (currentGame == "OutFall 4")
  22. {
  23. if (money >= 39.99)
  24. {
  25. Console.WriteLine("Bought OutFall 4");
  26. money -= 39.99;
  27. }
  28. else
  29. {
  30. Console.WriteLine("Too Expensive");
  31. }
  32. }
  33. else if (currentGame == "CS: GO")
  34. {
  35. if (money >= 15.99)
  36. {
  37. Console.WriteLine("Bought CS: GO");
  38. money -= 15.99;
  39. }
  40. else
  41. {
  42. Console.WriteLine("Too Expensive");
  43. }
  44. }
  45. else if (currentGame == "Zplinter Zell")
  46. {
  47. if (money >= 19.99)
  48. {
  49. Console.WriteLine("Bought Zplinter Zell");
  50. money -= 19.99;
  51. }
  52. else
  53. {
  54. Console.WriteLine("Too Expensive");
  55. }
  56. }
  57. else if (currentGame == "Honored 2")
  58. {
  59. if (money >= 59.99)
  60. {
  61. Console.WriteLine("Bought Honored 2");
  62. money -= 59.99;
  63. }
  64. else
  65. {
  66. Console.WriteLine("Too Expensive");
  67. }
  68. }
  69. else if (currentGame == "RoverWatch")
  70. {
  71. if (money >= 29.99)
  72. {
  73. Console.WriteLine("Bought RoverWatch");
  74. money -= 29.99;
  75. }
  76. else
  77. {
  78. Console.WriteLine("Too Expensive");
  79. }
  80. }
  81. else if (currentGame == "RoverWatch Origins Edition")
  82. {
  83. if (money >= 39.99)
  84. {
  85. Console.WriteLine("Bought RoverWatch Origins Edition");
  86. money -= 39.99;
  87. }
  88. else
  89. {
  90. Console.WriteLine("Too Expensive");
  91. }
  92. }
  93. else if (currentGame == "Game Time")
  94. {
  95. Console.WriteLine($"Total spent: ${(leftMoney - money):f2}. Remaining: ${money:f2}");
  96. break;
  97. }
  98. else
  99. {
  100. Console.WriteLine("Not Found");
  101. }
  102. }
  103. }
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement