Fixed code and UML-diagram

generic-observer
SirTeruki 7 years ago
parent 759c43969e
commit 168df83a60

@ -2,6 +2,8 @@ package _3._1;
public class BankUser { public class BankUser {
private String name; private String name;
private HomeAddress homeAddress;
private WorkAddress workAddress;
public String getName() { public String getName() {
return name; return name;
@ -10,4 +12,20 @@ public class BankUser {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public HomeAddress getHomeAddress() {
return homeAddress;
}
public void setHomeAddress(HomeAddress homeAddress) {
this.homeAddress = homeAddress;
}
public WorkAddress getWorkAddress() {
return workAddress;
}
public void setWorkAddress(WorkAddress workAddress) {
this.workAddress = workAddress;
}
} }

@ -11,12 +11,12 @@ public class Banking {
thorin.setAccounts(new Account[1]); thorin.setAccounts(new Account[1]);
thorin.getAccounts()[0] = sbt.getAccounts()[0]; thorin.getAccounts()[0] = sbt.getAccounts()[0];
thorin.setName("Thorin"); thorin.setName("Thorin");
Address home = new Address(); HomeAddress home = new HomeAddress();
home.setStreet("Kingsroad 1"); home.setStreet("Kingsroad 1");
home.setPostCode("12345"); home.setPostCode("12345");
home.setCity("Dunland"); home.setCity("Dunland");
thorin.setHomeAddress(home); thorin.setHomeAddress(home);
Address work = new Address(); WorkAddress work = new WorkAddress("Evil Corp");
work.setStreet("Throneroom 1"); work.setStreet("Throneroom 1");
work.setPostCode("54321"); work.setPostCode("54321");
work.setCity("Erebor"); work.setCity("Erebor");

@ -1,19 +1,10 @@
package _3._1; package _3._1;
public class Customer extends BankUser{ public class Customer extends BankUser {
private String name;
private Account[] accounts;
private Address homeAddress;
private Address workAddress;
public String getName() { private Account[] accounts;
return name;
}
public void setName(String name) {
this.name = name;
}
public Account[] getAccounts() { public Account[] getAccounts() {
return accounts; return accounts;
@ -23,20 +14,5 @@ public class Customer extends BankUser{
this.accounts = 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;
}
} }

@ -1,5 +1,14 @@
package _3._1; package _3._1;
public class HomeAddress { public class HomeAddress extends Address {
private PostOfficeBox postOfficeBox;
public PostOfficeBox getPostOfficeBox() {
return postOfficeBox;
}
public void setPostOfficeBox(PostOfficeBox postOfficeBox) {
this.postOfficeBox = postOfficeBox;
}
} }

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?><diagram program="umlet" version="13.3"> <?xml version="1.0" encoding="UTF-8"?><diagram program="umlet" version="13.3">
<zoom_level>10</zoom_level> <zoom_level>7</zoom_level>
<element> <element>
<id>UMLClass</id> <id>UMLClass</id>
<coordinates> <coordinates>
<x>460</x> <x>637</x>
<y>250</y> <y>175</y>
<w>210</w> <w>147</w>
<h>200</h> <h>140</h>
</coordinates> </coordinates>
<panel_attributes>*Customer* <panel_attributes>*BankUser*
-- --
- name: String
</panel_attributes> </panel_attributes>
<additional_attributes/> <additional_attributes/>
@ -18,10 +18,10 @@
<element> <element>
<id>UMLClass</id> <id>UMLClass</id>
<coordinates> <coordinates>
<x>460</x> <x>637</x>
<y>0</y> <y>0</y>
<w>210</w> <w>147</w>
<h>90</h> <h>63</h>
</coordinates> </coordinates>
<panel_attributes>*Account* <panel_attributes>*Account*
-- --
@ -34,10 +34,10 @@ Account(iban: String)</panel_attributes>
<element> <element>
<id>UMLClass</id> <id>UMLClass</id>
<coordinates> <coordinates>
<x>0</x> <x>119</x>
<y>250</y> <y>147</y>
<w>210</w> <w>147</w>
<h>180</h> <h>126</h>
</coordinates> </coordinates>
<panel_attributes>*Adress* <panel_attributes>*Adress*
-- --
@ -49,10 +49,10 @@ Account(iban: String)</panel_attributes>
<element> <element>
<id>UMLClass</id> <id>UMLClass</id>
<coordinates> <coordinates>
<x>10</x> <x>322</x>
<y>0</y> <y>0</y>
<w>210</w> <w>147</w>
<h>70</h> <h>49</h>
</coordinates> </coordinates>
<panel_attributes>*Bank* <panel_attributes>*Bank*
-- --
@ -64,51 +64,51 @@ Account(iban: String)</panel_attributes>
<element> <element>
<id>Relation</id> <id>Relation</id>
<coordinates> <coordinates>
<x>560</x> <x>777</x>
<y>80</y> <y>28</y>
<w>100</w> <w>231</w>
<h>190</h> <h>175</h>
</coordinates> </coordinates>
<panel_attributes>lt=&lt;-&gt; <panel_attributes>lt=&lt;-&gt;
r2=-holders r2=-holders
m2=1..* m2=1..*
r1=-accounts r1=-accounts
m1=0..*</panel_attributes> m1=0..*</panel_attributes>
<additional_attributes>10.0;10.0;10.0;170.0</additional_attributes> <additional_attributes>10.0;20.0;260.0;20.0;260.0;230.0</additional_attributes>
</element> </element>
<element> <element>
<id>Relation</id> <id>Relation</id>
<coordinates> <coordinates>
<x>200</x> <x>497</x>
<y>250</y> <y>175</y>
<w>280</w> <w>154</w>
<h>50</h> <h>35</h>
</coordinates> </coordinates>
<panel_attributes>lt=&lt;- <panel_attributes>lt=-&gt;
r1=-homeAddress r2=-workAddress
m1=1</panel_attributes> m2=0..1</panel_attributes>
<additional_attributes>260.0;20.0;10.0;20.0</additional_attributes> <additional_attributes>200.0;20.0;10.0;20.0</additional_attributes>
</element> </element>
<element> <element>
<id>Relation</id> <id>Relation</id>
<coordinates> <coordinates>
<x>200</x> <x>497</x>
<y>350</y> <y>245</y>
<w>280</w> <w>154</w>
<h>50</h> <h>35</h>
</coordinates> </coordinates>
<panel_attributes>lt=&lt;- <panel_attributes>lt=-&gt;
m1=-workAddress r2=-homeAddress
r1=1</panel_attributes> m2=0..1</panel_attributes>
<additional_attributes>260.0;20.0;10.0;20.0</additional_attributes> <additional_attributes>200.0;20.0;10.0;20.0</additional_attributes>
</element> </element>
<element> <element>
<id>UMLClass</id> <id>UMLClass</id>
<coordinates> <coordinates>
<x>0</x> <x>357</x>
<y>530</y> <y>154</y>
<w>210</w> <w>147</w>
<h>70</h> <h>49</h>
</coordinates> </coordinates>
<panel_attributes>*WorkAdress* <panel_attributes>*WorkAdress*
-- --
@ -118,45 +118,23 @@ r1=1</panel_attributes>
<element> <element>
<id>UMLClass</id> <id>UMLClass</id>
<coordinates> <coordinates>
<x>270</x> <x>357</x>
<y>480</y> <y>224</y>
<w>210</w> <w>147</w>
<h>70</h> <h>49</h>
</coordinates> </coordinates>
<panel_attributes>*HomeAddress* <panel_attributes>*HomeAddress*
-- --
</panel_attributes> </panel_attributes>
<additional_attributes/> <additional_attributes/>
</element> </element>
<element>
<id>Relation</id>
<coordinates>
<x>40</x>
<y>420</y>
<w>30</w>
<h>130</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;10.0;110.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>160</x>
<y>420</y>
<w>170</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;150.0;60.0</additional_attributes>
</element>
<element> <element>
<id>UMLClass</id> <id>UMLClass</id>
<coordinates> <coordinates>
<x>270</x> <x>357</x>
<y>650</y> <y>343</y>
<w>210</w> <w>147</w>
<h>70</h> <h>49</h>
</coordinates> </coordinates>
<panel_attributes>*PostOfficeBox* <panel_attributes>*PostOfficeBox*
-- --
@ -167,10 +145,10 @@ r1=1</panel_attributes>
<element> <element>
<id>Relation</id> <id>Relation</id>
<coordinates> <coordinates>
<x>310</x> <x>385</x>
<y>540</y> <y>266</y>
<w>130</w> <w>91</w>
<h>130</h> <h>91</h>
</coordinates> </coordinates>
<panel_attributes>lt=&lt;- <panel_attributes>lt=&lt;-
r1=-postOfficeBox r1=-postOfficeBox
@ -180,49 +158,49 @@ m1=0..1</panel_attributes>
<element> <element>
<id>UMLClass</id> <id>UMLClass</id>
<coordinates> <coordinates>
<x>520</x> <x>679</x>
<y>570</y> <y>399</y>
<w>210</w> <w>147</w>
<h>70</h> <h>49</h>
</coordinates> </coordinates>
<panel_attributes>*FinancialAdvisor* <panel_attributes>*FinancialAdvisor*
-- --
- customer: Customer[]</panel_attributes> </panel_attributes>
<additional_attributes/> <additional_attributes/>
</element> </element>
<element> <element>
<id>Relation</id> <id>Relation</id>
<coordinates> <coordinates>
<x>560</x> <x>707</x>
<y>440</y> <y>308</y>
<w>110</w> <w>21</w>
<h>150</h> <h>105</h>
</coordinates> </coordinates>
<panel_attributes>lt=&lt;- <panel_attributes>lt=&lt;&lt;-
r1=-customers </panel_attributes>
m1=0..*</panel_attributes>
<additional_attributes>10.0;10.0;10.0;130.0</additional_attributes> <additional_attributes>10.0;10.0;10.0;130.0</additional_attributes>
</element> </element>
<element> <element>
<id>UMLClass</id> <id>UMLClass</id>
<coordinates> <coordinates>
<x>800</x> <x>875</x>
<y>270</y> <y>189</y>
<w>210</w> <w>147</w>
<h>70</h> <h>49</h>
</coordinates> </coordinates>
<panel_attributes>*BankUser* <panel_attributes>*Customer*
-- --
- name: String</panel_attributes>
</panel_attributes>
<additional_attributes/> <additional_attributes/>
</element> </element>
<element> <element>
<id>Relation</id> <id>Relation</id>
<coordinates> <coordinates>
<x>660</x> <x>777</x>
<y>290</y> <y>203</y>
<w>160</w> <w>112</w>
<h>30</h> <h>21</h>
</coordinates> </coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes> <panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>140.0;10.0;10.0;10.0</additional_attributes> <additional_attributes>140.0;10.0;10.0;10.0</additional_attributes>
@ -230,25 +208,49 @@ m1=0..*</panel_attributes>
<element> <element>
<id>Relation</id> <id>Relation</id>
<coordinates> <coordinates>
<x>720</x> <x>819</x>
<y>330</y> <y>231</y>
<w>130</w> <w>203</w>
<h>300</h> <h>210</h>
</coordinates> </coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes> <panel_attributes>lt=&lt;-
<additional_attributes>110.0;10.0;10.0;280.0</additional_attributes> r1=-customers
m1=0..*</panel_attributes>
<additional_attributes>190.0;10.0;190.0;280.0;10.0;280.0</additional_attributes>
</element> </element>
<element> <element>
<id>Relation</id> <id>Relation</id>
<coordinates> <coordinates>
<x>210</x> <x>462</x>
<y>20</y> <y>14</y>
<w>270</w> <w>189</w>
<h>50</h> <h>35</h>
</coordinates> </coordinates>
<panel_attributes>lt=&lt;&lt;&lt;&lt;-&gt; <panel_attributes>lt=&lt;&lt;&lt;&lt;-&gt;
r2=-accounts r2=-accounts
m2=0..*</panel_attributes> m2=0..*</panel_attributes>
<additional_attributes>10.0;20.0;250.0;20.0</additional_attributes> <additional_attributes>10.0;20.0;250.0;20.0</additional_attributes>
</element> </element>
<element>
<id>Relation</id>
<coordinates>
<x>259</x>
<y>175</y>
<w>112</w>
<h>21</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;140.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>259</x>
<y>245</y>
<w>112</w>
<h>21</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;140.0;10.0</additional_attributes>
</element>
</diagram> </diagram>

Loading…
Cancel
Save