Advertisement
svetlyoek

Untitled

Jan 24th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp138
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double balance = double.Parse(Console.ReadLine());
  10. double price = 0;
  11. double leftMoney = 0;
  12. double sum = 0;
  13. while (true)
  14. {
  15. string game = Console.ReadLine();
  16. if (game == "Game Time")
  17. {
  18. break;
  19. }
  20. if (game == "OutFall4" && game == "RoverWatchOriginsEdition")
  21. {
  22. price = 39.99;
  23. sum += price;
  24. }
  25. else if (game == "CS:OG")
  26. {
  27. price = 15.99;
  28. sum += price;
  29. }
  30. else if (game == "ZplinterZell")
  31. {
  32. price = 19.99;
  33. sum += price;
  34. }
  35. else if (game == "Honored2")
  36. {
  37. price = 59.99;
  38. sum += price;
  39. }
  40. else if (game == "RoverWatch")
  41. {
  42. price = 29.99;
  43. sum += price;
  44.  
  45. }
  46. else if (game != "RoverWatch" || game != "Honored2" || game != "ZplinterZell" || game != "CS:OG" || game != "OutFall4" ||
  47. game != "RoverWatchOriginsEdition")
  48. {
  49. Console.WriteLine("Not Found");
  50. }
  51. else
  52. {
  53. Console.WriteLine("Bought {0}", game);
  54. balance -= price;
  55. }
  56.  
  57. leftMoney = balance -price;
  58.  
  59.  
  60. if (leftMoney < 0)
  61. {
  62. Console.WriteLine("Out of money!");
  63. return;
  64.  
  65. }
  66. if (leftMoney < price)
  67. {
  68. Console.WriteLine("Too Expensive");
  69. }
  70.  
  71.  
  72.  
  73. }
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80. Console.WriteLine("Total spent: ${0:f2}. Remaining: ${1:f2}.", sum, leftMoney);
  81. }
  82.  
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement