Aktienhandel #4

Merged
Denys Konovalov merged 22 commits from ibartkowski/info-java:main into main 2024-10-18 18:21:55 +02:00
Showing only changes of commit 192ae021dc - Show all commits

@ -1,44 +1,42 @@
package tech_store; import java.util.ArrayList;
import java.util.ArrayList; public class Order {
private int orderClientID;
public class Order { private ArrayList<OrderEntry> orderEntries;
private int orderClientID; private String orderDate;
private ArrayList<OrderEntry> orderEntries; public Order(int clientID, String date) {
private String orderDate; this.orderClientID = clientID;
public Order(int clientID, String date) { this.orderEntries = new ArrayList<OrderEntry>();
this.orderClientID = clientID; this.orderDate = date;
this.orderEntries = new ArrayList<OrderEntry>(); }
this.orderDate = date; public int getClientID() {
} return this.orderClientID;
public int getClientID() { }
return this.orderClientID; public String getDate() {
} return this.orderDate;
public String getDate() { }
return this.orderDate; public ArrayList<OrderEntry> getEntries() {
} return this.orderEntries;
public ArrayList<OrderEntry> getEntries() { }
return this.orderEntries; public void addEntry(OrderEntry entry) {
} this.orderEntries.add(entry);
public void addEntry(OrderEntry entry) { }
this.orderEntries.add(entry); public int calcPrice() {
} int price = 0;
public int calcPrice() { for (OrderEntry entry : this.orderEntries) {
int price = 0; price += entry.calcPrice();
for (OrderEntry entry : this.orderEntries) { }
price += entry.calcPrice(); return price;
} }
return price; public String createReceipt() {
} String output = "\n";
public String createReceipt() { for (OrderEntry entry : this.orderEntries) {
String output = "\n"; output += entry.toString() + ", Price: " + entry.calcPrice() + "\n";
for (OrderEntry entry : this.orderEntries) { }
output += entry.toString() + ", Price: " + entry.calcPrice() + "\n"; output += "=====" + this.calcPrice() + "=====";
} return output;
output += "=====" + this.calcPrice() + "====="; }
return output; public String toString() {
} return ("Client: " + this.orderClientID + ", Date: " + this.orderDate);
public String toString() { }
return ("Client: " + this.orderClientID + ", Date: " + this.orderDate); }
}
}