Advertisement
Guest User

Untitled

a guest
May 29th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.48 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         double currentBalance = double.Parse(Console.ReadLine());
  8.         double spentMoney = 0;
  9.         bool outFall4 = false;
  10.         bool cSOG = false;
  11.         bool zplinterZell = false;
  12.         bool honored2 = false;
  13.         bool rovetWatch = false;
  14.         bool rovetWatchOrigins = false;
  15.         while (true)
  16.         {
  17.             string game = Console.ReadLine();
  18.             if (game == "OutFall 4")
  19.             {
  20.                 outFall4 = true;
  21.                 currentBalance -= 39.99;
  22.                 spentMoney += 39.99;
  23.                 if (currentBalance < 0)
  24.                 {
  25.                     outFall4 = false;
  26.                     Console.WriteLine("Too Expensive");
  27.                     currentBalance += 39.99;
  28.                     spentMoney -= 39.99;
  29.                 }
  30.             }
  31.             else if (game == "CS:OG")
  32.             {
  33.                 cSOG = true;
  34.                 currentBalance -= 15.99;
  35.                 spentMoney += 15.99;
  36.                 if (currentBalance < 0)
  37.                 {
  38.                     cSOG = false;
  39.                     Console.WriteLine("Too Expensive");
  40.                     currentBalance += 15.99;
  41.                     spentMoney -= 15.99;
  42.  
  43.                 }
  44.             }
  45.             else if (game == "Zplinter Zell")
  46.             {
  47.                 zplinterZell = true;
  48.                 currentBalance -= 19.99;
  49.                 spentMoney += 19.99;
  50.                 if (currentBalance < 0)
  51.                 {
  52.                     zplinterZell = false;
  53.                     Console.WriteLine("Too Expensive");
  54.                     currentBalance += 19.99;
  55.                     spentMoney -= 19.99;
  56.                 }
  57.             }
  58.             else if (game == "RoverWatch")
  59.             {
  60.                 rovetWatch = true;
  61.                 currentBalance -= 29.99;
  62.                 spentMoney += 29.99;
  63.                 if (currentBalance < 0)
  64.                 {
  65.                     rovetWatch = false;
  66.                     Console.WriteLine("Too Expensive");
  67.                     currentBalance += 29.99;
  68.                     spentMoney -= 29.99;
  69.                 }
  70.             }
  71.             else if (game == "Honored 2")
  72.             {
  73.                 honored2 = true;
  74.                 currentBalance -= 59.99;
  75.                 spentMoney += 59.99;
  76.                 if (currentBalance < 0)
  77.                 {
  78.                     honored2 = false;
  79.                     Console.WriteLine("Too Expensive");
  80.                     currentBalance += 59.99;
  81.                     spentMoney -= 59.99;
  82.                 }
  83.             }
  84.  
  85.             else if (game == "RoverWatch Origins Edition")
  86.             {
  87.                 rovetWatchOrigins = true;
  88.                 currentBalance -= 39.99;
  89.                 spentMoney += 39.99;
  90.                 if (currentBalance < 0)
  91.                 {
  92.                     rovetWatchOrigins = false;
  93.                     Console.WriteLine("Too Expensive");
  94.                     currentBalance += 39.99;
  95.                     spentMoney -= 39.99;
  96.                 }
  97.             }
  98.             else if (game == "Game Time")
  99.             {
  100.                 if (outFall4)
  101.                 {
  102.                     Console.WriteLine("Bought OutFall 4");
  103.                 }
  104.                 if (cSOG)
  105.                 {
  106.                     Console.WriteLine("Bought CS:OG");
  107.  
  108.                 }
  109.                 if (rovetWatch)
  110.                 {
  111.                     Console.WriteLine("Bought RoverWatch");
  112.                 }
  113.                 if (honored2)
  114.                 {
  115.                     Console.WriteLine("Bought Honored 2");
  116.                 }
  117.                 if (zplinterZell)
  118.                 {
  119.                     Console.WriteLine("Bought Zplinter Zell");
  120.                 }
  121.                
  122.                 if (rovetWatchOrigins)
  123.                 {
  124.                     Console.WriteLine("Bought RoverWatch Origins Edition");
  125.                 }
  126.  
  127.                 if (currentBalance > 0)
  128.                 {
  129.                     Console.WriteLine($"Total spent: ${spentMoney}. Remaining: ${currentBalance:F2}");
  130.                     return;
  131.                 }
  132.                 else
  133.                 {
  134.                         Console.WriteLine("Out of money!");
  135.                    return;
  136.                 }
  137.                
  138.  
  139.             }
  140.             else
  141.             {
  142.                 Console.WriteLine("Not Found");
  143.             }
  144.  
  145.         }
  146.     }
  147. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement