Advertisement
wis3_guy

Savings Class

Mar 7th, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. /*
  2. if amount < (balance - minBalance)
  3. Subtract amount from balance
  4. else
  5. throw PolicyException(“Insufficient Funds”)
  6. endIf
  7. return amount*/
  8.  
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13.  
  14. namespace atm_program
  15. {
  16. class Savings : Account
  17. {
  18. private double interestRate;
  19. private double minBalance;
  20.  
  21.  
  22. public double InterestRate
  23. {
  24. get {return interestRate;}
  25. set { interestRate = value; }
  26. }
  27.  
  28. public double MinBalance
  29. {
  30. get { return minBalance; }
  31. set { minBalance = value; }
  32. }
  33.  
  34. //Constructor
  35. public Savings(long acctNumber) : base (acctNumber)
  36. {
  37. minBalance = 0.00;
  38. minBalance = balance;
  39. }
  40.  
  41. //Methods
  42. public override double Withdrawal(double amount)
  43. {
  44. if ((amount < (balance - minBalance)))
  45. {
  46. balance = balance-amount;
  47. }
  48. else
  49. {
  50. throw new PolicyException ("Insufficient Funds");
  51. }
  52. return amount;
  53. }
  54.  
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement