Advertisement
koksibg

Vapor_Store

Jun 7th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.70 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Vapor_Store
  4. {
  5.     class Vapor_Store
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double priceOutFall = 39.99;
  10.             double priceCS = 15.99;
  11.             double priceZplinter = 19.99;
  12.             double priceHonored = 59.99;
  13.             double priceRoverWatch = 29.99;
  14.             double priceRoverWatchOrig = 39.99;
  15.  
  16.             int countOutFall = 0;
  17.             int countCS = 0;
  18.             int countZplinter = 0;
  19.             int countHonored = 0;
  20.             int countRoverWatch = 0;
  21.             int countRoverWatchOrig = 0;
  22.             double sumPrice = 0;
  23.  
  24.             double balans = double.Parse(Console.ReadLine());
  25.             string game = null;
  26.  
  27.             while (game != "Game Time")
  28.             {
  29.                 game = Console.ReadLine();
  30.                 if (game == "CS: OG")
  31.                 {
  32.                     if (balans < priceCS)
  33.                     {
  34.                         Console.WriteLine($"Too Expensive");
  35.                         continue;
  36.                     }
  37.                     else
  38.                     {
  39.                         Console.WriteLine($"Bought {game}");
  40.                         balans -= priceCS;
  41.                         countCS++;
  42.                     }
  43.                 }
  44.                 else if (game == "Zplinter Zell")
  45.                 {
  46.                     if (balans < priceZplinter)
  47.                     {
  48.                         Console.WriteLine($"Too Expensive");
  49.                         continue;
  50.                     }
  51.                     else
  52.                     {
  53.                         Console.WriteLine($"Bought {game}");
  54.                         balans -= priceZplinter;
  55.                         countZplinter++;
  56.                     }
  57.                 }
  58.                 else if (game == "RoverWatch")
  59.                 {
  60.                     if (balans < priceRoverWatch)
  61.                     {
  62.                         Console.WriteLine($"Too Expensive");
  63.                         continue;
  64.                     }
  65.                     else
  66.                     {
  67.                         Console.WriteLine($"Bought {game}");
  68.                         balans -= priceRoverWatch;
  69.                         countRoverWatch++;
  70.                     }
  71.                 }
  72.                 else if (game == "RoverWatch Origins Edition")
  73.                 {
  74.                     if (balans < priceRoverWatchOrig)
  75.                     {
  76.                         Console.WriteLine($"Too Expensive");
  77.                         continue;
  78.                     }
  79.                     else
  80.                     {
  81.                         Console.WriteLine($"Bought {game}");
  82.                         balans -= priceRoverWatchOrig;
  83.                         countRoverWatchOrig++;
  84.                     }
  85.                 }
  86.                 else if (game == "OutFall 4")
  87.                 {
  88.                     if (balans < priceOutFall)
  89.                     {
  90.                         Console.WriteLine($"Too Expensive");
  91.                         continue;
  92.                     }
  93.                     else
  94.                     {
  95.                         Console.WriteLine($"Bought {game}");
  96.                         balans -= priceOutFall;
  97.                         countOutFall++;
  98.                     }
  99.                 }
  100.                 else if (game == "Honored 2")
  101.                 {
  102.                     if (balans < priceHonored)
  103.                     {
  104.                         Console.WriteLine($"Too Expensive");
  105.                         continue;
  106.                     }
  107.                     else
  108.                     {
  109.                         Console.WriteLine($"Bought {game}");
  110.                         balans -= priceHonored;
  111.                         countHonored++;
  112.                     }
  113.                 }
  114.                 else if (game == "Game Time") break;
  115.                 else if (game != "OutFall 4" && game != "CS: OG" && game != "Zplinter Zell" &&
  116.                          game != "Honored 2" && game != "RoverWatch" && game != "RoverWatch Origins Edition")
  117.                 {
  118.                     Console.WriteLine($"Not Found");
  119.                     continue;
  120.                 }
  121.                
  122.                 if (balans <= 0)
  123.                 {
  124.                     Console.WriteLine($"Out of money!");
  125.                     return;
  126.                 }
  127.             }
  128.             sumPrice = countOutFall * priceOutFall + countCS * priceCS + countZplinter * priceZplinter +
  129.                        countHonored * priceHonored + countRoverWatch * priceRoverWatch +
  130.                        countRoverWatchOrig * priceRoverWatchOrig;
  131.             Console.WriteLine($"Total spent: ${sumPrice:f2}. Remaining: ${balans:f2}");
  132.         }
  133.     }
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement