-
-
Save devjaime/a53601e60987634fa8a92ef92d842a26 to your computer and use it in GitHub Desktop.
interfaz para pruebas
This file contains hidden or 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
| public interface IAccount | |
| { | |
| double CurrentBallance { get; } | |
| double Deposit(double amount); | |
| double Withdraw(double amount); | |
| } | |
| public class Account : IAccount | |
| { | |
| double _balance; | |
| public double CurrentBallance { get { return _balance; } } | |
| public double Deposit(double amount) | |
| { | |
| if (amount > 0) | |
| { | |
| _balance += amount; | |
| return _balance; | |
| } | |
| else | |
| { | |
| throw new ArgumentException("Invalid Deposit Amount!"); | |
| } | |
| } | |
| public Double Withdraw(double amount) | |
| { | |
| if (amount > 0 && _balance >= amount) | |
| { | |
| _balance -= amount; | |
| } | |
| else | |
| { | |
| throw new ArgumentException("No balance to Withdraw!"); | |
| } | |
| return _balance; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment