Note that there are some explanatory texts on larger screens.

plurals
  1. POUML class diagram implementation Address-Addressbook
    primarykey
    data
    text
    <p>I have 2 class diagrams, class Address</p> <pre><code>+forename +surename +street +houseno +code +state +toString </code></pre> <p>second Addressbook</p> <pre><code>insert(address: Address) toString() searchSurename (surename: string): Address[*] +searchForename(forename: string): Address[*] </code></pre> <p>i implemented address:</p> <pre><code>public class Address { public static String forename; public static String surename; public static String street; public static int houseno; public static int code; public static String state; public String toString(){ return this.forename + this.surename + this.street + this.houseno + this.code + this.state; } </code></pre> <p>How can I implement Addressbook as easy as possible?</p> <p>EDIT:</p> <pre><code>public class addressbook{ private static ArrayList&lt;Address&gt; book; public addressbook(){ book = new ArrayList&lt;Address&gt;(); } </code></pre> <p>}</p> <p>EDIT QUESTION:</p> <p>Am I allowed to add new methods or attributes in a implementation outside the ones that we use in our class diagrams? </p> <p>EDIT 2:</p> <p>First try implementing method searchSurename with an ArrayList:</p> <pre><code>public static String searchSurename(String surename){ boolean exist = false; if(this.addresses.isEmpty()){ return null; } for(int i=0;i&lt;this.addresses.size();i++) { if(this.addresses.get(i).getSurename() == surename) { exist=true; break; } if(exist) { return this.addresses.get(surename); } else { return this.addresses.get(surename); } } // return ?!? } </code></pre> <p>The Program give me Errors at "this" at any line, maybe a mistake but I cant tell! It Looks a Little bit too difficult, I don't find any implementations where searching through a list is simple.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload