Advertisement
Terziyski

Vapor Store

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