diff --git a/bin/Grundlagen.class b/bin/Grundlagen.class deleted file mode 100644 index d9e5b46..0000000 Binary files a/bin/Grundlagen.class and /dev/null differ diff --git a/bin/Testcode.class b/bin/Testcode.class index d991a43..2236c6e 100644 Binary files a/bin/Testcode.class and b/bin/Testcode.class differ diff --git a/src/Testcode.java b/src/Testcode.java index b4f417b..f76ca5e 100644 --- a/src/Testcode.java +++ b/src/Testcode.java @@ -1,5 +1,7 @@ import java.util.Random; +import javax.swing.JOptionPane; + public class Testcode { public static void main(String[] args) { System.out.println("A code request you have made,"); @@ -24,5 +26,21 @@ public class Testcode { System.out.println("The sum of " + x + " " + y + " and " + z + " is: " + sum); System.out.println("May the code be with you!"); + + // Testing Inputs with a gap text + + // Display a popup dialog and get user input + String a = JOptionPane.showInputDialog("Please enter a verb (-ing):"); + String b = JOptionPane.showInputDialog("Please enter a location:"); + + if ((a == null || a.trim().isEmpty()) && (b == null || b.trim().isEmpty())) { + System.out.println("No words entered or both canceled."); + } else if (a == null || a.trim().isEmpty()) { + System.out.println("The verb was not entered or canceled."); + } else if (b == null || b.trim().isEmpty()) { + System.out.println("The location was not entered or canceled."); + } else { + System.out.println("They were " + a + " throw a " + b ); + } } -} \ No newline at end of file +}