Last active
January 13, 2023 17:07
-
-
Save masleshov/60c71dbb488f73278af48399c57a7ca9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Encapsulation | |
{ | |
public class BankAccount | |
{ | |
private string _number; | |
private int _clientId; | |
private decimal _amountInUsd; | |
private decimal _amountInEur; | |
public void DepositUsd(decimal amount) | |
{ | |
if (amount <= 0) | |
{ | |
throw new ArgumentException("Values less or equal zero are not allowed!"); | |
} | |
_amountInUsd += amount; | |
_amountInEur += ConvertToEur(amount); | |
} | |
public void DepositEur(decimal amount) | |
{ | |
if (amount <= 0) | |
{ | |
throw new ArgumentException("Values less or equal zero are not allowed!"); | |
} | |
_amountInEur += amount; | |
_amountInUsd += ConvertToUsd(amount); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment