Skip to content
Snippets Groups Projects
Commit b31d2e6b authored by jonas.stirnema's avatar jonas.stirnema
Browse files

Added constructor with just name and fname

parent ef456ccc
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,17 @@ public class Contact {
setJob(new String(""));
}
// Only family name and one first name
public Contact(String fname, String name) {
setFname(new String(fname));
setNames(Arrays.asList(name));
setAddress(new String(""));
setPhoneNumbers(Arrays.asList(""));
setEmails(Arrays.asList(""));
setSocials(Arrays.asList(""));
setJob(new String(""));
}
public Contact(String name, List<String> names, String address, List<String> phones, List<String> emails,
List<String> socials,
String job) {
......
......@@ -51,7 +51,7 @@ public class DynArray {
}
public void make_sure_size(Contact a) {
if ((this.size + a.length) > this.capacity) // Overflow?
if ((this.size + 1) > this.capacity) // Overflow?
{
// Realloc new array
this.capacity *= 2;
......
......@@ -9,15 +9,16 @@ public class Main {
Arrays.asList(""),
Arrays.asList("@Jonas", "@TPO"),
"Eboueur");
Contact c2 = new Contact();
Contact c3 = new Contact("fnamekek", "joseph");
c1.show();
c2.show();
c3.show();
System.out.println(c1.toShortString());
c2.showShort();
DynArray contacts = new DynArray();
contacts.append();
//DynArray contacts = new DynArray();
//contacts.append();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment