Guest User

Untitled

a guest
Jan 19th, 2020
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace GamingStore
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. float currentBalance = float.Parse(Console.ReadLine());
  10. float gamePrice = 0;
  11. float moneySpent = 0;
  12.  
  13. string command = Console.ReadLine();
  14. while (command != "Game Time")
  15. {
  16.  
  17. if (command == "OutFall 4")
  18. {
  19. gamePrice = 39.99f;
  20. }
  21. else if (command == "CS: OG")
  22. {
  23. gamePrice = 15.99f;
  24. }
  25. else if (command == "Zplinter Zell")
  26. {
  27. gamePrice = 19.99f;
  28. }
  29. else if (command == "Honored 2")
  30. {
  31. gamePrice = 59.99f;
  32. }
  33. else if (command == "RoverWatch")
  34. {
  35. gamePrice = 29.99f;
  36. }
  37. else if (command == "RoverWatch Origins Edition")
  38. {
  39. gamePrice = 39.99f;
  40. }
  41. else
  42. {
  43. Console.WriteLine("Not Found");
  44. }
  45.  
  46.  
  47. if (currentBalance >= gamePrice && command == "RoverWatch" || command == "RoverWatch Origins Edition" || command == "Honored 2" || command == "Zplinter Zell" || command == "CS: OG" || command == "OutFall 4")
  48. {
  49. currentBalance -= gamePrice;
  50. moneySpent += gamePrice;
  51. Console.WriteLine($"Bought {command}");
  52. if (currentBalance <= 0)
  53. {
  54. Console.WriteLine("Out of money!");
  55. return;
  56. }
  57.  
  58. }
  59. else if (currentBalance < gamePrice)
  60. {
  61. Console.WriteLine("Too Expensive");
  62. }
  63.  
  64. command = Console.ReadLine();
  65. }
  66. float totalMoneySpent = moneySpent;
  67. Console.WriteLine($"Total spent: ${totalMoneySpent:f2}. Remaining: ${currentBalance:f2}");
  68. }
  69. }
  70. }
RAW Paste Data