Skip to content

Instantly share code, notes, and snippets.

@domingoladron
Last active December 28, 2021 19:39
Show Gist options
  • Save domingoladron/4926595f4c1fb98dd538540f8f2b7b1c to your computer and use it in GitHub Desktop.
Save domingoladron/4926595f4c1fb98dd538540f8f2b7b1c to your computer and use it in GitHub Desktop.
ATM-Machine-Class-Usage.cs
private static void CallGoodAtmMachine()
{
//Call a factory to get back our atm interface implementation
var atmMachine = AtmMachineFactory.GetAtmMachine();
atmMachine.Login(5555);
var balance = atmMachine.CheckBalance(accountId);
Console.WriteLine($"I checked my balance on account #{accountId}. The balance is now ${balance}");
var myMoneyToSpend = atmMachine.Withdraw(20, accountId);
Console.WriteLine($"I withdrew some money from the ATM. I got out {myMoneyToSpend.Value}");
balance = atmMachine.CheckBalance(accountId);
Console.WriteLine($"I checked my balance on account #{accountId}. The balance is now ${balance}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment