private void Bet()
 {
     try
     {
         decimal amount = EnterConsoleValue.GetDecimal("Enter your Amount, please");
         Console.WriteLine("Enter your Currency, please");
         string currency = Console.ReadLine();
         if (currency == "Stop")
         {
             throw new StopException();
         }
         ActivePlayer.Withdraw(amount, currency);
         decimal result = betService.Bet(amount);
         if (result != 0)
         {
             ActivePlayer.Deposit(result, currency);
             Console.WriteLine("You win: {0} {1}", result, currency);
         }
         else
         {
             Console.WriteLine("You lose");
         }
     }
     catch (StopException)
     {
     }
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            try
            {
                Player player = new Player("Vasya", "Gritsin", "*****@*****.**", "123", "EUR");
                player.Deposit(100, "UAH");
                player.Withdraw(2, "USD");
            }
            catch (InvalidOperationException)
            {
                Console.WriteLine("Try again bro");
            }
            catch
            {
                throw;
            }



            Console.ReadLine();
        }