Improved the Gaptext

This commit is contained in:
Sage Burger 2023-08-22 09:29:30 +02:00
parent 735fd61747
commit 7cf18e66db
2 changed files with 5 additions and 8 deletions

Binary file not shown.

View file

@ -31,23 +31,20 @@ public class Grundlagen {
} }
// Lückentexte / kombination aus variablen, print und if/else // Lückentexte / kombination aus variablen, print und if/else
// Display a popup dialog and get user input
// Popups mit User Input // Popups mit User Input
String a = JOptionPane.showInputDialog("Please enter a verb (-ing):"); String a = JOptionPane.showInputDialog("Please enter a verb (-ing):");
String b = JOptionPane.showInputDialog("Please enter a location:"); String b = JOptionPane.showInputDialog("Please enter a location:");
String c = JOptionPane.showInputDialog("Please enter a color:"); String c = JOptionPane.showInputDialog("Please enter a color:");
String d = JOptionPane.showInputDialog("Please enter an object in that color:"); String d = JOptionPane.showInputDialog("Please enter something that's that color:");
String e = JOptionPane.showInputDialog("Please enter a diffrent color:"); String e = JOptionPane.showInputDialog("Please enter a diffrent color:");
String f = JOptionPane.showInputDialog("Please enter an object in that color:"); String f = JOptionPane.showInputDialog("Please enter something that's that color:");
String g = JOptionPane.showInputDialog("Please enter an adjective:"); String g = JOptionPane.showInputDialog("Please enter an adjective:");
String h = JOptionPane.showInputDialog("Please enter an object"); String h = JOptionPane.showInputDialog("Please enter an object");
// Error message // Error message
if ((a == null || a.trim().isEmpty()) && (b == null || b.trim().isEmpty())) { if (a == null || a.trim().isEmpty()) {
System.out.println("Missing word(s) or canceled.");
} else if (a == null || a.trim().isEmpty()) {
System.out.println("Missing word(s) or canceled."); System.out.println("Missing word(s) or canceled.");
} else if (b == null || b.trim().isEmpty()) { } else if (b == null || b.trim().isEmpty()) {
System.out.println("Missing word(s) or canceled."); System.out.println("Missing word(s) or canceled.");
@ -67,8 +64,8 @@ public class Grundlagen {
// Lückentext mit variablen // Lückentext mit variablen
System.out.println("They where " + a + " throw a " + b + ". They're eyes where "); System.out.println("They where " + a + " throw (a) " + b + ". They're eyes where ");
System.out.println(c + " as the " + d + " They're hair as " + e + " as " + f + "."); System.out.println(c + " as (the) " + d + " They're hair as " + e + " as (the) " + f + ".");
System.out.println("It was a " + g + " day, after a long journey they finally found their " + h); System.out.println("It was a " + g + " day, after a long journey they finally found their " + h);
} }
} }