Initial commit for 3.1
parent
c7d3b0cea0
commit
07f9fe9b4d
@ -0,0 +1,21 @@
|
|||||||
|
package _3._1;
|
||||||
|
|
||||||
|
public class Account {
|
||||||
|
|
||||||
|
private Customer[] holders;
|
||||||
|
private long balance;
|
||||||
|
private String iban;
|
||||||
|
|
||||||
|
public Account(String iban) { this.iban = iban; }
|
||||||
|
|
||||||
|
public Customer[] getHolders() { return holders; }
|
||||||
|
|
||||||
|
public void setHolders(Customer[] holders) { this.holders = holders; }
|
||||||
|
|
||||||
|
public long getBalance() { return balance; }
|
||||||
|
|
||||||
|
public void setBalance(long balance) { this.balance = balance; }
|
||||||
|
|
||||||
|
public String getIban() { return iban; }
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package _3._1;
|
||||||
|
|
||||||
|
public class Address {
|
||||||
|
|
||||||
|
private String street;
|
||||||
|
private String postCode;
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
public String getStreet() { return street; }
|
||||||
|
|
||||||
|
public void setStreet(String street) { this.street = street; }
|
||||||
|
|
||||||
|
public String getPostCode() { return postCode; }
|
||||||
|
|
||||||
|
public void setPostCode(String postCode) { this.postCode = postCode; }
|
||||||
|
|
||||||
|
public String getCity() { return city; }
|
||||||
|
|
||||||
|
public void setCity(String city) { this.city = city; }
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package _3._1;
|
||||||
|
|
||||||
|
public class Bank {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private Account[] accounts;
|
||||||
|
|
||||||
|
public Bank(String name) { this.name = name; }
|
||||||
|
|
||||||
|
public String getName() { return name; }
|
||||||
|
|
||||||
|
public void setName(String name) { this.name = name; }
|
||||||
|
|
||||||
|
public Account[] getAccounts() { return accounts; }
|
||||||
|
|
||||||
|
public void setAccounts(Account[] accounts) { this.accounts = accounts; }
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package _3._1;
|
||||||
|
|
||||||
|
public class Banking {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Bank sbt = new Bank("Smaug Bank & Trust");
|
||||||
|
sbt.setAccounts(new Account[1]);
|
||||||
|
sbt.getAccounts()[0] = new Account("ER99123412341234123412");
|
||||||
|
sbt.getAccounts()[0].setBalance(54100000000L);
|
||||||
|
Customer thorin = new Customer();
|
||||||
|
thorin.setAccounts(new Account[1]);
|
||||||
|
thorin.getAccounts()[0] = sbt.getAccounts()[0];
|
||||||
|
thorin.setName("Thorin");
|
||||||
|
Address home = new Address();
|
||||||
|
home.setStreet("Kingsroad 1");
|
||||||
|
home.setPostCode("12345");
|
||||||
|
home.setCity("Dunland");
|
||||||
|
thorin.setHomeAddress(home);
|
||||||
|
Address work = new Address();
|
||||||
|
work.setStreet("Throneroom 1");
|
||||||
|
work.setPostCode("54321");
|
||||||
|
work.setCity("Erebor");
|
||||||
|
thorin.setWorkAddress(work);
|
||||||
|
sbt.getAccounts()[0].setHolders(new Customer[] { thorin });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package _3._1;
|
||||||
|
|
||||||
|
public class Customer {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private Account[] accounts;
|
||||||
|
private Address homeAddress;
|
||||||
|
private Address workAddress;
|
||||||
|
|
||||||
|
public String getName() { return name; }
|
||||||
|
|
||||||
|
public void setName(String name) { this.name = name; }
|
||||||
|
|
||||||
|
public Account[] getAccounts() { return accounts; }
|
||||||
|
|
||||||
|
public void setAccounts(Account[] accounts) { this.accounts = accounts; }
|
||||||
|
|
||||||
|
public Address getHomeAddress() { return homeAddress; }
|
||||||
|
|
||||||
|
public void setHomeAddress(Address homeAddress) { this.homeAddress = homeAddress; }
|
||||||
|
|
||||||
|
public Address getWorkAddress() { return workAddress; }
|
||||||
|
|
||||||
|
public void setWorkAddress(Address workAddress) { this.workAddress = workAddress; }
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue