Skip to content

Commit c73bf41

Browse files
Merge pull request #139 from wendelinwemhoener/disallow-empty-flashcard-back
Disallow empty flashcard back
2 parents 05c5c3d + 70a5c2a commit c73bf41

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

data/flashcards/flashcard.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
3 | cs2113 | software enginnering | 3
22
5 | Hello | Duke | 4
3-
7 | Hello | Duke | 5
4-
9 | id | checker | 5
3+
7 | Hello | Duke | 4
4+
9 | id | checker | 6
55
10 | id increases | correctly | 5
6-
11 | f | dfdf | 5
6+
11 | f | dfdf | 5
7+
12 | dfdf | | 5
8+
13 | 1 | j | 5

src/main/java/seedu/duke/flashcard/command/CreateFlashcardCommand.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ public void execute(Scanner scanner, FlashcardList flashcardList) {
3535
System.out.print(" Enter the back page text: ");
3636
String backPageText = scanner.nextLine();
3737

38+
while (backPageText.strip().equals("")) {
39+
System.out.println(" Invalid input! The back text must " +
40+
"contain at least one letter or digit!");
41+
42+
System.out.print(" Enter the back page text: ");
43+
backPageText = scanner.nextLine();
44+
}
45+
3846
Flashcard flashcard = new Flashcard(frontPageText, backPageText);
3947

4048
flashcardList.add(flashcard);

0 commit comments

Comments
 (0)