BubaLazi

VaporStore2

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