Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package sysmodu56.models;
- import java.math.BigInteger;
- import java.util.HashMap;
- import java.util.Observable;
- public class Person extends Observable {
- private boolean visible = true;
- private BigInteger ssn;
- private String name;
- private HashMap<String, Account> accounts = new HashMap<String, Account>();
- public Person() { }
- public Person(String pName, String pSsn) {
- setName(pName);
- setSsn(new BigInteger(pSsn));
- }
- public boolean getVisible() {
- return visible;
- }
- public void setVisible(boolean nextVisible) {
- visible = nextVisible;
- setChanged();
- notifyObservers(this);
- }
- public BigInteger getSsn() {
- return ssn;
- }
- public String getFormattedSsn(){
- String ssnString = ssn.toString();
- return ssnString.substring(0, 6) + "-" + ssnString.substring(6, ssnString.length());
- }
- public void setSsn(BigInteger nextSsn) {
- ssn = nextSsn;
- setChanged();
- notifyObservers(this);
- }
- public String getName() {
- return name;
- }
- public void setName(String nextName) {
- name = nextName;
- setChanged();
- notifyObservers(this);
- }
- public void addAccount(Account newAccount) {
- accounts.put(newAccount.getNumber(), newAccount);
- setChanged();
- notifyObservers(this);
- }
- public Account getAccount(String number) {
- return accounts.get(number);
- }
- public HashMap<String, Account> getAccounts() {
- return accounts;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement