Advertisement
wis3_guy

Account Class

Mar 7th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace atm_program
  7. {
  8. class Account
  9. {
  10. //Members
  11. private long acctNo;
  12. protected double balance;
  13.  
  14. //Properties, get & set methods
  15. public long AcctNo
  16. {
  17. get { return acctNo; }
  18. set { acctNo = value; }
  19. }
  20.  
  21. public double Balance
  22. {
  23. get { return balance; }
  24. }
  25.  
  26. //Constructors
  27.  
  28. //Note: No default constructors!
  29.  
  30. public Account(long acctNumber)
  31. {
  32. acctNo = acctNumber;
  33.  
  34. }
  35.  
  36. // Methods
  37.  
  38.  
  39. public virtual double Deposit(double amount)
  40. {
  41. balance = amount + balance;
  42. return balance;
  43. }
  44.  
  45. public virtual double Withdrawal(double amount)
  46. {
  47. balance = balance - amount;
  48. return amount;
  49.  
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement