Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Vokaltest: in diesem Programm geht darum, ob ein Vokal
- * eingegeb wurde oder nicht. Es finden auch die Umlaute Anwendung!
- * Autor: Mario Hansen
- * Datum: 30.08.2017
- */
- import javax.swing.JOptionPane;
- public class Vokaltest {
- public static void main(String[] args) {
- String eingabe;
- char c;
- boolean istVokal;
- eingabe = JOptionPane.showInputDialog("Gib einen Buchstaben ein: ");
- c = eingabe.charAt(0);
- if (c == 'a' || c == 'A') {
- istVokal = true;
- } else {
- if (c == 'e' || c == 'E') {
- istVokal = true;
- } else {
- if (c == 'i' || c == 'I') {
- istVokal = true;
- } else {
- if (c == 'o' || c == 'O'){
- istVokal = true;
- } else {
- if (c == 'u' || c == 'U') {
- istVokal = true;
- } else {
- if (c == '\u00e4' || c == '\u00c4') {
- istVokal = true;
- } else {
- if (c == '\u00f6' || c == '\u00d6') {
- istVokal = true;
- } else {
- if (c == '\u00fc' || c == '\u00dc') {
- istVokal = true;
- } else {
- istVokal = false;
- }
- }
- }
- }
- }
- }
- }
- }
- if (istVokal == true) {
- JOptionPane.showMessageDialog(null, c + " ist ein Vokal!");
- } else {
- JOptionPane.showMessageDialog(null, c + " ist kein Vokal!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment