Mario_Hansen

Vokaltest.java

Sep 4th, 2017
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.29 KB | None | 0 0
  1. /* Vokaltest: in diesem Programm geht darum, ob ein Vokal
  2.  * eingegeb wurde oder nicht. Es finden auch die Umlaute Anwendung!
  3.  * Autor: Mario Hansen
  4.  * Datum: 30.08.2017
  5.  */
  6.  
  7. import javax.swing.JOptionPane;
  8.  
  9. public class Vokaltest {
  10.     public static void main(String[] args) {
  11.         String eingabe;
  12.     char c;
  13.     boolean istVokal;
  14.     eingabe = JOptionPane.showInputDialog("Gib einen Buchstaben ein: ");
  15.     c = eingabe.charAt(0);
  16.  
  17.     if (c == 'a' || c == 'A') {
  18.         istVokal = true;
  19.     } else {
  20.         if (c == 'e' || c == 'E') {
  21.             istVokal = true;
  22.         } else {
  23.         if (c == 'i' || c == 'I') {
  24.             istVokal = true;
  25.         } else {
  26.             if (c == 'o' || c == 'O'){
  27.             istVokal = true;
  28.             } else {
  29.             if (c == 'u' || c == 'U') {
  30.                 istVokal = true;
  31.             } else {
  32.                 if (c == '\u00e4' || c == '\u00c4') {
  33.                 istVokal = true;
  34.                 } else {
  35.                 if (c == '\u00f6' || c == '\u00d6') {
  36.                     istVokal = true;
  37.                 } else {
  38.                     if (c == '\u00fc' || c == '\u00dc') {
  39.                     istVokal = true;
  40.                     } else {
  41.                     istVokal = false;
  42.                     }
  43.                     }
  44.                 }
  45.             }
  46.             }
  47.         }
  48.         }
  49.     }
  50.     if (istVokal == true) {
  51.         JOptionPane.showMessageDialog(null, c + " ist ein Vokal!");
  52.     } else {
  53.         JOptionPane.showMessageDialog(null, c + " ist kein Vokal!");
  54.     }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment