Advertisement
JuliaPetkova

Untitled

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