Advertisement
Guest User

Untitled

a guest
May 27th, 2017
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 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.  
  8. namespace _26._06._2017
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             double balance = double.Parse(Console.ReadLine());
  15.             double balance1 = balance;
  16.             double spent = 0;
  17.             double remaining = 0;
  18.             double gamePrice = 0.0;
  19.             string game;
  20.             for (int i = 0; ; i++)
  21.             {
  22.                 game = Console.ReadLine();
  23.                 if (balance <= 0)
  24.                 { Console.WriteLine("Out Of money"); break; }
  25.                 if (game != "Game Time")
  26.                 {
  27.                     if (game == "OutFall 4")
  28.                     {
  29.                         gamePrice = 39.99;
  30.                     }
  31.                     else if (game == "CS: OG")
  32.                     {
  33.                         gamePrice = 15.99;
  34.                     }
  35.                     else if (game == "Zplinter Zell")
  36.                     { gamePrice += 19.99; }
  37.                     else if (game == "Honored 2")
  38.                     { gamePrice += 59.99; }
  39.                     else if (game == "RoverWatch")
  40.                     { gamePrice += 29.99; }
  41.                     else if (game == "RoverWatch Origins Edition")
  42.                     { gamePrice += 39.99; }
  43.                     else
  44.                     {
  45.                         Console.WriteLine("Not Found");
  46.                         continue;
  47.                     }
  48.  
  49.                     if (balance < gamePrice)
  50.                     {
  51.                         Console.WriteLine("Too Expensive");continue;
  52.                     }
  53.                     else
  54.                     {
  55.                         balance1 -= gamePrice;
  56.                         Console.WriteLine("Bought " + game);
  57.                     }
  58.                 }
  59.                 else
  60.                 {
  61.  
  62.                     Console.Write("Total spent: $");
  63.                     Console.Write("{0:F2}", gamePrice);
  64.                     Console.Write(". Remaining: $");
  65.                     Console.WriteLine("{0:f2}", balance - gamePrice); break;
  66.                 }
  67.  
  68.             }
  69.  
  70.  
  71.         }
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement