00001 using System; 00002 00008 00020 public class BankAccount { 00021 00022 protected double interestRate; 00023 protected string owner; 00024 protected decimal balance; 00025 00035 public BankAccount(string o, decimal b, double ir) { 00036 this.interestRate = ir; 00037 this.owner = o; 00038 this.balance = b; 00039 } 00040 00049 public BankAccount(string o, double ir): 00050 this(o, 0.0M, ir) { 00051 } 00052 00058 public virtual decimal Balance { 00059 get {return balance;} 00060 } 00061 00072 public virtual void Withdraw (decimal amount) { 00073 balance -= amount; 00074 } 00075 00084 public virtual void Deposit (decimal amount) { 00085 balance += amount; 00086 } 00087 00092 public virtual void AddInterests() { 00093 balance += balance * (Decimal)interestRate; 00094 } 00095 00100 public override string ToString() { 00101 return owner + "'s account holds " + 00102 + balance + " kroner"; 00103 } 00104 }