Skip to content

Instantly share code, notes, and snippets.

@bitbrain
Last active September 4, 2015 18:16
Show Gist options
  • Save bitbrain/1e7ac33ff98d6c225f63 to your computer and use it in GitHub Desktop.
Save bitbrain/1e7ac33ff98d6c225f63 to your computer and use it in GitHub Desktop.
float[] euroKurse = {
0.93f, // Wechselkurs, Währung 1
4.49f, // Wechselkurs, Währung 2
1.29f, // Wechselkurs, Währung 3
3.49f // Wechselkurs, Währung 4
};
String[] kursNamen = {
"Yen", // Name, Währung 1
"Dollar", // Name, Währung 2
"Franken", // Name, Währung 3
"Kronen" // Name, Währung 4
};
int ausgewaehlterIndex = jComboBox.getSelectedIndex();
float aktuellerKurs = euroKurse[ausgewaehlterIndex];
float neuerBetrag = Float.valueOf(jTextField.getText()) * aktuellerKurs;
outputLabel.setText(String.valueOf(neuerBetrag) + kursNamen[ausgewaehlterIndex]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment