Всем привет! Дошёл только до 7-го уровня, и с этими знаниями пытаюсь создать примитивные программы для учеников английского. Я уже целый день пытаюсь убрать повторы предложений, но никак не выходит. И, чем дальше, тем, мне кажется, код становится только хуже, а голова уже не соображает((
Вот код:
public static void presentBeTest1() {
System.out.println("Определите, какую информацию несет глагол 'be' в следующих предложениях (местоположение 'p' или описание 'd'):");
Scanner scanner = new Scanner(System.in);
String[][] placesDescription = {{"She is in the shower.", "He is at home.", " They are outside.", "The purse is in the bag",
"My mobile phone is on the desk.", "Harry is in Hogwarts.", "Monica is next to me."}, {"He is handsome.", "My cellphone is out of charge.",
"They are unpleasant people.", "Anna is a great singer.", "Your movie is like heaven.", "We are the people of manners.",
"How is your leg?"}};
String p = "p";
String d = "d";
int count = 0;
String[] a = new String[14];
for (int i = 0; i < a.length; i++) {
int number1 = (int) (Math.round(Math.random()));
int number2 = (int) (Math.random()* 7);
String question = placesDescription[number1][number2];
if (number1 == 0 && question!=null) {
for (int j = 0; j < placesDescription[number1].length; j++) {
System.out.println(question);
String answer = scanner.nextLine();
if (answer.equals(p)) {
System.out.println(GOOD_CONTINUE);
a[count] = question;
placesDescription[number1][number2] = null;
i = 0;
count++;
break;
} else if (answer.equals(d)) {
System.out.println(BAD_THINK);
}
}
} else if (number1 == 1 && question != null) {
for (int j = 0; j < placesDescription[number1].length; j++) {
System.out.println(question);
String answer = scanner.nextLine();
if (answer.equals(d)) {
System.out.println(GOOD_CONTINUE);
a[count] = question;
placesDescription[number1][number2] = null;
i = 0;
count++;
break;
} else if (answer.equals(p)) {
System.out.println(BAD_THINK);
}
}
}
if (count == a.length) {
break;
}
}
System.out.println(Arrays.toString(a));
}