|
@ -16,8 +16,8 @@ public class ProgrammMain { |
|
|
String[][] karteikarten = { { "Was ist die Hauptstadt von Deutschland?", "Berlin" }, |
|
|
String[][] karteikarten = { { "Was ist die Hauptstadt von Deutschland?", "Berlin" }, |
|
|
{ "Welches ist der größtes Planet in unserem Sonnensystem?", "Jupiter" }, |
|
|
{ "Welches ist der größtes Planet in unserem Sonnensystem?", "Jupiter" }, |
|
|
{ "Wer hat die Mona Lisa gemalt?", "Leonardo da Vinci" }, |
|
|
{ "Wer hat die Mona Lisa gemalt?", "Leonardo da Vinci" }, |
|
|
{"Wer ist der Bundeskanzler von Deutschland?", "Olaf Scholz"}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ "Wer ist der Bundeskanzler von Deutschland?", "Olaf Scholz" }, |
|
|
|
|
|
|
|
|
// Sonstige Fragen |
|
|
// Sonstige Fragen |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -65,7 +65,7 @@ public class ProgrammMain { |
|
|
} else { |
|
|
} else { |
|
|
System.out.println("Falsch!"); |
|
|
System.out.println("Falsch!"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -153,54 +153,31 @@ public class ProgrammMain { |
|
|
} |
|
|
} |
|
|
return binary; |
|
|
return binary; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class FactorialCalculator { |
|
|
public class FactorialCalculator { |
|
|
|
|
|
|
|
|
public static int calculateFactorial(int number) { |
|
|
|
|
|
if (number <= 0) { |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
int result = 1; |
|
|
|
|
|
for (int i = 1; i <= number; i++) { |
|
|
|
|
|
result *= i; |
|
|
|
|
|
} |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
|
int number = 5; |
|
|
|
|
|
int result = calculateFactorial(number); |
|
|
|
|
|
System.out.println(number + "! = " + result); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void schaltjahr() { |
|
|
|
|
|
|
|
|
|
|
|
System.out.println("Welches Jahr möchtest du untersuchen?"); |
|
|
|
|
|
|
|
|
|
|
|
try (Scanner scanner2 = new Scanner(System.in)) { |
|
|
|
|
|
String jahr = scanner2.nextLine(); |
|
|
|
|
|
int jahr1 = Integer.parseInt(jahr); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int calculateFactorial(int number) { |
|
|
|
|
|
if (number <= 0) { |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
int result = 1; |
|
|
|
|
|
for (int i = 1; i <= number; i++) { |
|
|
|
|
|
result *= i; |
|
|
|
|
|
} |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Bestimmen+Ausgabe |
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
|
int number = 5; |
|
|
|
|
|
int result = calculateFactorial(number); |
|
|
|
|
|
System.out.println(number + "! = " + result); |
|
|
|
|
|
|
|
|
if( jahr1 % 400 == 0 ) System.out.println("Schaltjahr!"); |
|
|
|
|
|
else if( jahr1 % 100 == 0 ) System.out.println("Kein Schaltjahr!"); |
|
|
|
|
|
else if( jahr1 % 4 == 0 ) System.out.println("Schaltjahr!"); |
|
|
|
|
|
else System.out.println("Kein Schaltjahr!"); |
|
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
|
// TODO Auto-generated catch block |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
public static void main(String[] args) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("Willkommen bei diesem kleinen konsolenbasierten Spiel!\n"); |
|
|
System.out.println("Willkommen bei diesem kleinen konsolenbasierten Spiel!\n"); |
|
|
System.out.println("Du hast 3 Spielmodi!\n"); |
|
|
System.out.println("Du hast 3 Spielmodi!\n"); |
|
|
System.out.println("1. Karteikarten\n"); |
|
|
System.out.println("1. Karteikarten\n"); |
|
@ -240,5 +217,5 @@ public class ProgrammMain { |
|
|
System.out.println("Programm beendet\n"); |
|
|
System.out.println("Programm beendet\n"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |