Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. package sysmodu56.models;
  2.  
  3. import java.math.BigInteger;
  4. import java.util.HashMap;
  5. import java.util.Observable;
  6.  
  7. public class Person extends Observable {
  8. private boolean visible = true;
  9. private BigInteger ssn;
  10. private String name;
  11. private HashMap<String, Account> accounts = new HashMap<String, Account>();
  12.  
  13. public Person() { }
  14.  
  15. public Person(String pName, String pSsn) {
  16. setName(pName);
  17. setSsn(new BigInteger(pSsn));
  18. }
  19.  
  20. public boolean getVisible() {
  21. return visible;
  22. }
  23.  
  24. public void setVisible(boolean nextVisible) {
  25. visible = nextVisible;
  26. setChanged();
  27. notifyObservers(this);
  28. }
  29.  
  30. public BigInteger getSsn() {
  31. return ssn;
  32. }
  33.  
  34. public String getFormattedSsn(){
  35. String ssnString = ssn.toString();
  36. return ssnString.substring(0, 6) + "-" + ssnString.substring(6, ssnString.length());
  37. }
  38.  
  39. public void setSsn(BigInteger nextSsn) {
  40. ssn = nextSsn;
  41. setChanged();
  42. notifyObservers(this);
  43. }
  44.  
  45. public String getName() {
  46. return name;
  47. }
  48.  
  49. public void setName(String nextName) {
  50. name = nextName;
  51. setChanged();
  52. notifyObservers(this);
  53. }
  54.  
  55. public void addAccount(Account newAccount) {
  56. accounts.put(newAccount.getNumber(), newAccount);
  57. setChanged();
  58. notifyObservers(this);
  59. }
  60.  
  61. public Account getAccount(String number) {
  62. return accounts.get(number);
  63. }
  64.  
  65. public HashMap<String, Account> getAccounts() {
  66. return accounts;
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement