You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.0 KiB
Java
31 lines
1.0 KiB
Java
package com.company.kopffitness;
|
|
|
|
import java.util.Scanner;
|
|
|
|
public class mainAusgabe {
|
|
|
|
public static void main(String[] args){
|
|
|
|
MultiplicationQuiz mq = new MultiplicationQuiz();
|
|
Scanner scanner = new Scanner(System.in);
|
|
int programmEnde = 0;
|
|
while (programmEnde == 0) {
|
|
System.out.println("Wie ist das Ergebniss von:");
|
|
System.out.println(mq.getExercise());
|
|
String ergebnissEingabe = scanner.nextLine().replace("-", "");
|
|
|
|
if (!ergebnissEingabe.equals("x")) {
|
|
int ergebniss = Integer.parseInt(ergebnissEingabe);
|
|
int ergebnissRichtig = mq.getResult();
|
|
if (ergebnissRichtig == ergebniss) {
|
|
System.out.println("Ihr Ergebniss ist Richtig");
|
|
} else {
|
|
System.out.println("Ihr Ergebniss ist falsch. Die richtige Lösung wäre: " + ergebnissRichtig);
|
|
}
|
|
}else{
|
|
programmEnde = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|