00001 using System; 00002 00007 public class BankAccount { 00008 00009 private double interestRate; 00010 private string owner; 00011 private double balance; 00012 00019 public BankAccount(string owner): 00020 this(owner, 0.0, 0.0) { 00021 } 00022 00029 public BankAccount(string owner, double balance): 00030 this(owner, balance, 0.0) { 00031 } 00032 00042 public BankAccount(string owner, double balance, double interestRate) { 00043 this.interestRate = interestRate; 00044 this.owner = owner; 00045 this.balance = balance; 00046 } 00047 00053 public double Balance { 00054 get{ 00055 return balance; 00056 } 00057 } 00058 00063 public double InterestRate { 00064 get{ 00065 return interestRate; 00066 } 00067 } 00068 00077 public void Withdraw (double amount) { 00078 balance -= amount; 00079 } 00080 00089 public void Deposit (double amount) { 00090 balance += amount; 00091 } 00092 00097 public void AddInterests() { 00098 balance = balance + balance * interestRate; 00099 } 00100 00105 public override string ToString() { 00106 return owner + "'s account holds " + 00107 + balance + " kroner"; 00108 } 00109 }