Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions src/flashcards/Main.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
package flashcards;

import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.print("Hello world!");
Scanner sc = new Scanner(System.in);

System.out.println("Input the number of cards: ");
int n = sc.nextInt();
int i;
String possible = sc.nextLine();
String[] questions = new String[n];
String[] answers = new String[n];

for (i = 0; i < n; i++) {
System.out.println("The card #" + (i+1) + ":");
questions[i] = sc.nextLine();
System.out.println("The definition of the card #" + (i+1) + ":");
answers[i] = sc.nextLine();
}

for (i = 0; i < n; i++) {
System.out.println("Print the definition of \"" + questions[i] + "\":");
possible = sc.nextLine();
if (possible.equalsIgnoreCase(answers[i])) {
System.out.print("Correct answer. ");
} else {
System.out.println("Wrong answer (the correct one is \"" + answers[i] +"\").");
}
}

}
}
}