Compare commits

..

No commits in common. "75d4d3e627c640f765f975f705dc199ba8da6d6d" and "89bb3a674e4304644c37109ed5a608b97926deb9" have entirely different histories.

11 changed files with 7 additions and 191 deletions

@ -1,37 +0,0 @@
public class Aktie{
private String name;
private int count;
private double value;
public Aktie(String name, int count, double value) {
this.name = name;
this.count = count;
this.value = value;
}
public double getAktienWert() {
return count * value;
}
public void anzahlErhoehen(int amt) {
this.count += amt;
}
public void anzahlVerringern(int amt) {
this.count -= (this.count < amt) ? 0 : amt;
}
public String getName() {
return this.name;
}
public int getCount() {
return this.count;
}
public double getValue() {
return this.value;
}
public void setName(String name) {
this.name = name;
}
public void setCount(int count) {
this.count = count;
}
public void setValue(int value) {
this.value = value;
}
}

@ -1,16 +0,0 @@
public class Broker extends Person {
protected double provision;
protected int clientCount;
public Broker(String name, int age, double money, double provision, int clientCount) {
super(name, age, money);
this.provision = provision;
this.clientCount = clientCount;
}
public void tradeAbwickeln(Trader trader, String aktieName, double price, int amt) {
trader.aktieKaufen(aktieName, price, amt);
this.money += this.provision;
}
public void kundenAnzeigen() {
System.out.println("Kunden: " + this.clientCount);
}
}

@ -1,15 +0,0 @@
public class DayTrader extends Trader {
protected int tradesPerDay;
protected boolean hebelTrade;
public DayTrader(String name, int age, double money, int tradesPerDay, boolean hebelTrade) {
super(name, age, money);
this.tradesPerDay = tradesPerDay;
this.hebelTrade = hebelTrade;
}
public void schnellerTrade(double profit) {
this.money += profit;
}
public void risikoEingrenzen() {
//do stuff I guess
}
}

@ -1,15 +0,0 @@
public class LangfristInvestor extends Trader {
protected double dividends;
protected double investDuration;
public LangfristInvestor(String name, int age, double money, double dividends) {
super(name, age, money);
this.dividends = dividends;
}
public void dividendeErhalten(double amt) {
this.dividends += amt;
this.money += amt;
}
public void portfolioUmschichten() {
//stuff
}
}

@ -1,29 +0,0 @@
public class Main {
public static void main(String[] args) {
// Erstellen eines LangfristInvestors
LangfristInvestor investor = new LangfristInvestor("Lisa", 45, 20000, 10);
investor.aktieKaufen("Apple", 150, 10);
investor.dividendeErhalten(500);
investor.portfolioUmschichten();
investor.anzeigen();
// Erstellen eines Brokers
Broker broker = new Broker("Paul", 50, 50000, 100, 5);
broker.tradeAbwickeln(investor, "Apple", 150, 5);
broker.kundenAnzeigen();
// Erstellen eines OnlineBrokers
OnlineBroker onlineBroker = new OnlineBroker("OnlineTrade", 35, 100000, 50, 1000, 10, "TradeZone");
onlineBroker.gebuehrErheben(investor);
onlineBroker.neueKundenAkquirieren(50);
// Erstellen eines DayTraders
DayTrader dayTrader = new DayTrader("Tom", 30, 30000, 5, true);
dayTrader.aktieKaufen("Tesla", 700, 3);
dayTrader.schnellerTrade(300); // Profit von 300 EUR durch schnellen Trade
dayTrader.aktieVerkaufen("Tesla", 720, 2); // Verkauf von 2 Tesla-Aktien
dayTrader.anzeigen();
}
}

@ -1,16 +0,0 @@
public class OnlineBroker extends Broker {
protected double platformFee;
protected String platformName;
public OnlineBroker(String name, int age, double money, double provision, int clientCount, double platformFee, String platformName) {
super(name, age, money, provision, clientCount);
this.platformFee = platformFee;
this.platformName = platformName;
}
public void gebuehrErheben(Trader trader) {
trader.geldAuszahlen(this.platformFee);
this.money += this.platformFee;
}
public void neueKundenAkquirieren(int amt) {
this.clientCount += amt;
}
}

@ -1,19 +0,0 @@
public class Person {
protected String name;
protected int age;
protected double money;
public Person(String name, int age, double money) {
this.name = name;
this.age = age;
this.money = money;
}
public void geldEinzahlen(double amt) {
this.money += amt;
}
public void geldAuszahlen(double amt) {
this.money -= (this.money < amt) ? 0 : amt;
}
public void show() {
System.out.println("Name: " + name + ", Age: " + age + ", Money: " + money);
}
}

@ -1,37 +0,0 @@
import java.util.ArrayList;
public class Trader extends Person {
protected ArrayList<Aktie> aktien;
public Trader(String name, int age, double money) {
super(name, age, money);
this.aktien = new ArrayList<Aktie>();
}
public void aktieKaufen(String name, double price, int amt) {
Aktie aktie = new Aktie(name, amt, price);
this.aktien.add(aktie);
this.geldAuszahlen(aktie.getAktienWert());
}
public void aktieVerkaufen(String name, double price, int amt) {
for (Aktie aktie : this.aktien) {
if (aktie.getName() == name) {
this.geldEinzahlen(price * amt);
aktie.anzahlVerringern(amt);
break;
}
}
}
public double getPortfolioWert() {
double out = 0;
for (Aktie aktie : this.aktien) {
out += aktie.getAktienWert();
}
return out;
}
public void anzeigen() {
String out = "";
for (Aktie aktie : aktien) {
out += "\nAktie: " + aktie.getName() + ", Count: " + aktie.getCount() + ", Value: " + aktie.getValue();
}
System.out.println("Name: " + name + ", Age: " + age + ", Money: " + money + out + "\nGesamtwert: " + this.getPortfolioWert());
}
}

@ -3,9 +3,9 @@ import java.util.ArrayList;
public class OrderSystem {
private StorageManager systemManager;
private ArrayList<Client> systemClients;
public OrderSystem(StorageManager manager) {
public OrderSystem(StorageManager manager, ArrayList<Client> clients) {
this.systemManager = manager;
this.systemClients = new ArrayList<Client>();
this.systemClients = clients;
}
public void addProduct(Product product) {
this.systemManager.addProduct(product);

@ -2,8 +2,8 @@ import java.util.ArrayList;
public class StorageManager {
private ArrayList<Product> storageProducts;
public StorageManager() {
this.storageProducts = new ArrayList<Product>();
public StorageManager(ArrayList<Product> products) {
this.storageProducts = products;
}
public void addProduct(Product product) {
this.storageProducts.add(product);

@ -6,8 +6,8 @@ public class TechStore {
System.out.print(input);
}
public static void main(String[] args) {
StorageManager manager = new StorageManager();
OrderSystem system = new OrderSystem(manager);
StorageManager manager = new StorageManager(new ArrayList<Product>());
OrderSystem system = new OrderSystem(manager, new ArrayList<Client>());
Scanner scnr = new Scanner(System.in);
while (true) {
p("\nInput mode: ");