Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.JOptionPane;
- public class Tools {
- static int ZahlAbfragen(){
- String s = JOptionPane.showInputDialog("Bitte gib eine Zahl ein.");
- int zahl = Integer.parseInt(s);
- return zahl;
- }
- static void TextAusgeben(String text){
- System.out.println(text);
- }
- static int StringZuZahl(String s){
- int zahl = Integer.parseInt( s);
- return zahl;
- }
- static double KommazahlAbfrage(){
- String s = JOptionPane.showInputDialog("Bitte gib eine Kommazahl ein.");
- try {
- double zahl = Double.parseDouble(s);
- return zahl;
- } catch (Exception e) {
- TextAusgeben("Gib eine Zahl ein!");
- return KommazahlAbfrage();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement