Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package DiscoAuftrag;
- import javax.swing.*;
- public class Variante2 {
- public static void main(String[] args) {
- String name1 = JOptionPane.showInputDialog("Alterseingabe:");
- int Alter = Integer.parseInt(name1);
- if(Alter > 17){
- JOptionPane.showMessageDialog(null, "Sie dürfen ohne Einschränkungen feiern gehen!", "Eintritt", JOptionPane.PLAIN_MESSAGE);
- }
- else{
- if(Alter > 15){
- JOptionPane.showMessageDialog(null, "Eintritt bis 24 Uhr, aber keinen starken Alkohol!", "Eintritt", JOptionPane.PLAIN_MESSAGE);
- }
- else{
- if(Alter < 16){
- if(Alter > 4){
- int berechtigt = JOptionPane.showConfirmDialog(null, "Ist eine Begleitperson anwesend?");
- if (berechtigt == 0){
- JOptionPane.showMessageDialog(null, "Eintritt bis 24 Uhr, aber nur mit einem Erziehungsberechtigten!", "Regel System", JOptionPane.PLAIN_MESSAGE);
- }else if (berechtigt == 1){
- JOptionPane.showMessageDialog(null, "'piss dich!");
- }else if (berechtigt == 2){
- JOptionPane.showMessageDialog(null, "Vielleicht");
- }
- }
- else{
- JOptionPane.showMessageDialog(null, "Du bist etzala zu jung, bidde ferlass uns!", "Haider alarm!", JOptionPane.PLAIN_MESSAGE);
- }
- }
- else{
- JOptionPane.showMessageDialog(null, "Unbekannter Fehler", "Alarm", JOptionPane.PLAIN_MESSAGE);
- }
- }
- }
- }
- }
- //Zeile = Aufgabe
- //1 = JOptionPane wird importiert
- //7 = Abfrage des Alters
- //9 = Umwandeln vom String in Int
- //11-14 = über 18? => Eintritt Ja/Nein
- //15-18 = über 16? => Eintritt Ja/Nein
- //19-37 = unter 16? => Erziehungsberechtigter JA/NEIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement