All pastes #778749 Raw Edit

Anonym

public java v1 · immutable
·published 2007-11-17 21:44 UTC
rendered paste body
public class Konto {	protected int Saldo = 0;	protected String Inhaber;		public Konto (String name) {		Inhaber = name;		}		public void einzahlen (double betrag) {		Saldo += betrag;		System.out.println("Es wurden "+betrag+" Euro eingezahlt.\nDer neue Kontostand von "+Inhaber+" ist: "+Saldo+"Euro");	}		public void abheben (double betrag) {			if ((deckungPruefen(betrag)==false)) {			System.out.println("Soweit ist ihr Konto nicht gedeckt");		}		else {			Saldo -= betrag;			System.out.println("Sie haben "+betrag+" abgehoben.\nIhr neuer Konstostand ist: "+Saldo+"Euro");		}	}	public boolean deckungPruefen(double betrag) {		if ((Saldo - betrag) < 0) {			return (false);		}		else return(true);	}		public static void main(String[] args) {		Konto Peter = new Konto ("Peter");		Peter.einzahlen(600);		Peter.abheben(400);		Peter.abheben(300);				Tagesgeldkonto Hans = new Tagesgeldkonto("Hans");		Tagesgeldkonto.setzeZinssatz(10);		Hans.einzahlen(500);		Hans.zinsgutschrift();				Girokonto Klaus = new Girokonto("Klaus", 0);		Klaus.einzahlen(1000);		Klaus.abheben(2500);					}}public class Girokonto extends Konto {		public Girokonto(String name, double dispolimit) {		super(name);		Dispo = dispolimit;	}		public void ueberweisen(Konto empfaengerkonto, double betrag) {	empfaengerkonto.einzahlen(betrag);		}		public boolean deckungPruefen(double betrag) {		if ((super.Saldo+Dispo) < 0) {			System.out.println("Ihr Konto ist selbst mit Dispo nicht soweit gedeckt.");			return(false);		}		else return (true);	}		double Dispo;		public static void main(String[] args) {		// TODO Auto-generated method stub	}}