public void transfer(String quelle, String ziel, double umsatz) { Konto quelleKonto = kontoManager.findeKonto(quelle); Konto zielKonto = kontoManager.findeKonto(ziel); quelleKonto.soll(umsatz); zielKonto.haben(umsatz); kontoManager.updateKonto(quelleKonto); kontoManager.updateKonto(zielKonto); }
@Override public boolean ueberweisenAuf(Konto ziel, double betrag) { if (!studentenKonto && getKontoStand() + getKreditlimit() >= betrag + berechneUeberwGebuehren(betrag)) { gebuehren += berechneUeberwGebuehren(betrag); return super.abheben(betrag) && ziel.einzahlen(betrag); } else { return getKontoStand() + getKreditlimit() >= betrag && super.abheben(betrag) && ziel.einzahlen(betrag); } }
public static void main(String[] args) { Konto Philipp = new Konto("Philipp Kropik", "AT173837700000065599", "RZSTAT2G"); Konto Mayer = new Konto("Hans Mayer", "AT373837700000065599", "RZSTAT2G"); Philipp.aufbuchen(50); Mayer.aufbuchen(40); Philipp.Kontodrucker(); Mayer.Kontodrucker(); Philipp.aufbuchen(50); Mayer.abbuchen(40); Philipp.Kontodrucker(); Mayer.Kontodrucker(); }
public static void main(String[] args) { // TODO Auto-generated method stub Konto maxisKonto = new Konto("Max Musterman"); maxisKonto.aufbuchen(1000); System.out.println(maxisKonto.getKontostand()); maxisKonto.abbuchen(500); System.out.println(maxisKonto.getKontostand()); maxisKonto.abbuchen(600); System.out.println(maxisKonto.getKontostand()); }
public static void spilloop( Spiller player, Terning tern, Felt felt, Konto konto, Tur tur, Strings string) { if (GUI.getUserButtonPressed( player.getNavn() + string.getButtonPress(), string.getButtonPressAnswer()) .equals(string.getButtonPressAnswer())) { GUI.removeAllCars(player.getNavn()); GUI.setCar(tern.kast() - 1, player.getNavn()); GUI.showMessage("" + string.getFeltDesc((tern.getVærdi() - 2))); int feltværdi = felt.getFeltVærdi((tern.getVærdi() - 2), string); if (feltværdi > 0) { konto.deposit(feltværdi); GUI.setBalance(player.getNavn(), konto.getBeholdning()); if (konto.getBeholdning() >= 3000) { GUI.showMessage(player.getNavn() + string.getWinText()); if (GUI.getUserButtonPressed( string.getNewGameText(), string.getNewGameTextPositive(), string.getNewGameTextNegative()) .equals(string.getNewGameTextPositive())) { GUI.showMessage(string.getExitMessage()); System.exit(0); } else { System.exit(0); } } } else if (feltværdi < 0) { if (feltværdi < konto.getBeholdning()) { konto.withdraw(-feltværdi); GUI.setBalance(player.getNavn(), konto.getBeholdning()); } else { konto.withdraw(konto.getBeholdning()); } } if (tern.getVærdi() - 2 != 8) tur.skift(); } }