import java.awt.*; import java.applet.*; public class Java141101 extends Applet { double Zahl1, Zahl; String Einlesen1, Einlesen2, Ausgabe; FlowLayout FLGruss = new FlowLayout(6); TextField TfEinlesen1 = new TextField(6), TfEinlesen2 = new TextField(6), TfAusgabe = new TextField(6); Label LbInfo = new Label (" Bitte Geldbetrag eingeben:"); Button BtEuro = new Button("Euro"); Button BtFranc = new Button("Fraice"); Button BtSchilling = new Button("Schilling"); Button BtFranken = new Button("Franken"); Button BtDelete = new Button ("Neu"); public void init() { setBackground(Color.black); setForeground(Color.red); setLayout(FLGruss); add(LbInfo); add(TfEinlesen1); add(BtEuro); add(BtFranc); add(BtSchilling); add(BtFranken); add(BtDelete); add(TfAusgabe); add(TfEinlesen2); } public boolean action (Event e,Object o) { Einlesen1 = TfEinlesen1.getText(); Zahl1 = Integer.parseInt(Einlesen1); if (e.target == BtEuro) { Zahl = Zahl1 / 1.95583; Ausgabe = String.valueOf(Zahl); TfAusgabe.setText(Ausgabe); TfEinlesen2.setText("€"); }; if (e.target == BtFranc) { Zahl = Zahl1 * 3; Ausgabe = String.valueOf(Zahl); TfAusgabe.setText(Ausgabe); TfEinlesen2.setText("Fr"); }; if (e.target == BtSchilling) { Zahl = Zahl1 * 7; Ausgabe = String.valueOf(Zahl); TfAusgabe.setText(Ausgabe); TfEinlesen2.setText("Sch"); }; if (e.target == BtFranken) { Zahl = Zahl1 / 1.2; Ausgabe = String.valueOf(Zahl); TfAusgabe.setText(Ausgabe); TfEinlesen2.setText("sFr"); }; if (e.target == BtDelete) { TfEinlesen1.setText(""); TfEinlesen2.setText(""); TfAusgabe.setText(""); }; return true; } }