info-java/Technikladen/Client.java
Igor Bartkowski 89bb3a674e TechStore code (#1)
Technikladen-Aufgaben-Lösung hinzugefügt, weitere kleinere Änderungen werden noch folgen, aber funktional hiermit vollständig

Reviewed-on: #1
Reviewed-by: Denys Konovalov <kontakt@denyskon.de>
Co-authored-by: ibartkowski <ibartkowski@git.cantorgymnasium.de>
Co-committed-by: ibartkowski <ibartkowski@git.cantorgymnasium.de>
2024-10-14 19:12:15 +02:00

38 lines
937 B
Java
Executable File

import java.util.ArrayList;
public class Client {
private static int clientCounter;
private int clientID;
private String clientName;
private String clientEmail;
private ArrayList<Order> clientOrders;
public Client(String clientName, String clientEmail) {
clientCounter++;
this.clientID = clientCounter;
this.clientName = clientName;
this.clientEmail = clientEmail;
this.clientOrders = new ArrayList<Order>();
}
public int getID() {
return this.clientID;
}
public String getName() {
return this.clientName;
}
public String getEmail() {
return this.clientEmail;
}
public ArrayList<Order> getOrders() {
return this.clientOrders;
}
public void addOrder(Order order) {
this.clientOrders.add(order);
}
public boolean hasOrder() {
return !this.clientOrders.isEmpty();
}
public String toString() {
return ("ID: " + this.clientID + ", Name: " + this.clientName + ", Email: " + this.clientEmail);
}
}