Skip to content

Instantly share code, notes, and snippets.

@AbhinavPradeep
Created June 29, 2020 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbhinavPradeep/5ae445fc16a41aaf45156461afe02ba9 to your computer and use it in GitHub Desktop.
Save AbhinavPradeep/5ae445fc16a41aaf45156461afe02ba9 to your computer and use it in GitHub Desktop.
using System;
using System.Threading;
namespace MultiThreadedProgramming
{
class Account
{
public Account()
{
Balance = 0.00;
}
public Double Balance{get; private set;}
public void Withdraw(double Amount)
{
System.Console.WriteLine($"Trying to withdraw ${Amount}");
if (Balance >= Amount)
{
Thread.Sleep(10000);
Balance -= Amount;
System.Console.WriteLine($"Balance left after withdrawl = ${Balance}");
}
else
{
System.Console.WriteLine($"Sorry you only have ${Balance} left");
}
}
public void Deposit(double Amount)
{
Balance+= Amount;
System.Console.WriteLine($"Balance = ${Balance}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment