Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. package DiscoAuftrag;
  2. import javax.swing.*;
  3. public class Variante2 {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. String name1 = JOptionPane.showInputDialog("Alterseingabe:");
  8.  
  9. int Alter = Integer.parseInt(name1);
  10.  
  11. if(Alter > 17){
  12. JOptionPane.showMessageDialog(null, "Sie dürfen ohne Einschränkungen feiern gehen!", "Eintritt", JOptionPane.PLAIN_MESSAGE);
  13. }
  14. else{
  15. if(Alter > 15){
  16. JOptionPane.showMessageDialog(null, "Eintritt bis 24 Uhr, aber keinen starken Alkohol!", "Eintritt", JOptionPane.PLAIN_MESSAGE);
  17. }
  18. else{
  19. if(Alter < 16){
  20. if(Alter > 4){
  21. int berechtigt = JOptionPane.showConfirmDialog(null, "Ist eine Begleitperson anwesend?");
  22.  
  23. if (berechtigt == 0){
  24. JOptionPane.showMessageDialog(null, "Eintritt bis 24 Uhr, aber nur mit einem Erziehungsberechtigten!", "Regel System", JOptionPane.PLAIN_MESSAGE);
  25. }else if (berechtigt == 1){
  26. JOptionPane.showMessageDialog(null, "'piss dich!");
  27. }else if (berechtigt == 2){
  28. JOptionPane.showMessageDialog(null, "Vielleicht");
  29. }
  30. }
  31. else{
  32. JOptionPane.showMessageDialog(null, "Du bist etzala zu jung, bidde ferlass uns!", "Haider alarm!", JOptionPane.PLAIN_MESSAGE);
  33. }
  34. }
  35. else{
  36. JOptionPane.showMessageDialog(null, "Unbekannter Fehler", "Alarm", JOptionPane.PLAIN_MESSAGE);
  37. }
  38. }
  39. }
  40.  
  41.  
  42.  
  43. }
  44.  
  45. }
  46. //Zeile = Aufgabe
  47. //1 = JOptionPane wird importiert
  48. //7 = Abfrage des Alters
  49. //9 = Umwandeln vom String in Int
  50. //11-14 = über 18? => Eintritt Ja/Nein
  51. //15-18 = über 16? => Eintritt Ja/Nein
  52. //19-37 = unter 16? => Erziehungsberechtigter JA/NEIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement