WhatsappGruppe
parent
0d62c6e356
commit
e8d754c8b9
|
@ -8,6 +8,8 @@ public class Whatsapp extends Nacnhrichten {
|
|||
private Whatsapp empf;
|
||||
private ArrayList <String> speicherContact;
|
||||
private ArrayList <String> speicherNummern;
|
||||
private ArrayList <Whatsapp> addGrouppe;
|
||||
private String grouppeName;
|
||||
|
||||
|
||||
|
||||
|
@ -20,6 +22,8 @@ public class Whatsapp extends Nacnhrichten {
|
|||
this.empf = null;
|
||||
this.speicherContact = new ArrayList<>();
|
||||
this.speicherNummern = new ArrayList<>();
|
||||
this.addGrouppe = new ArrayList<>();
|
||||
this.grouppeName = null;
|
||||
|
||||
}
|
||||
|
||||
|
@ -29,6 +33,18 @@ public class Whatsapp extends Nacnhrichten {
|
|||
nachrichtenlists.add(getSendeNachricht());
|
||||
|
||||
}
|
||||
|
||||
public void addgrouppe(String grouppeName,ArrayList<Whatsapp> addGrouppe) {
|
||||
this.addGrouppe.addAll(addGrouppe);
|
||||
this.grouppeName = grouppeName;
|
||||
}
|
||||
|
||||
public void printgrouppe(){
|
||||
System.out.println(this.name + " hat die Grouppe " + this.grouppeName + " erstellt");
|
||||
for (int i = 0; i < addGrouppe.size(); i++){
|
||||
System.out.println(addGrouppe.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
public void addContact(String name, String teleN){
|
||||
if (name != null && teleN != null){
|
||||
|
@ -55,7 +71,6 @@ public class Whatsapp extends Nacnhrichten {
|
|||
for (int i = 0; i < speicherContact.size(); i++){
|
||||
System.out.println("Name: " + speicherContact.get(i) + ", Telefonnummer: " + speicherNummern.get(i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getSendeNachricht() {
|
||||
|
@ -71,10 +86,6 @@ public class Whatsapp extends Nacnhrichten {
|
|||
|
||||
return nachrichtenlists;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -6,11 +6,21 @@ public class WhatsappTest {
|
|||
public static void main(String[] args) {
|
||||
Whatsapp obai = new Whatsapp("obai", "049321384324");
|
||||
Whatsapp omar = new Whatsapp("Omar", "049321384324");
|
||||
Whatsapp abd = new Whatsapp("abd", "049321384324");
|
||||
|
||||
|
||||
obai.sendeNachricht(omar, "Hallo");
|
||||
omar.sendeNachricht(obai, "Hi");
|
||||
|
||||
Nacnhrichten.printNachrichtLists();
|
||||
|
||||
ArrayList<Whatsapp> gr1 = new ArrayList<>();
|
||||
gr1.add(omar);
|
||||
gr1.add(abd);
|
||||
obai.addgrouppe("Almidani",gr1);
|
||||
obai.printgrouppe();
|
||||
obai.addContact("abd", "049321384324");
|
||||
obai.printContacte();
|
||||
|
||||
//Nacnhrichten.printNachrichtLists();
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue