Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. public static void main(String[] args) throws FileNotFoundException {
  2.  
  3. System.out.println("Welcome to Flashcard Program vBeta/n" + "What you want to do?/n"
  4. + "/t1. Display a list of decks/n" + "/t2. Create a new deck/n"
  5. + "/t3. Set destination folder for flashcards (recommended for the first time)/n"
  6. + "/t4. What you want to be shown first in traditional view of flashbacks?");
  7.  
  8. Scanner scan = new Scanner(System.in);
  9. int sc = scan.nextInt();
  10.  
  11. if (sc == 1) {
  12. if (getLoc().equals("")) {
  13. System.out.println("Set the destination folder for the program");
  14. } else {
  15. System.out.println("Choose a deck");
  16. File f = new File(getLoc() + "\\flashcardList.txt");
  17. Scanner sf = new Scanner(f);
  18. int liczbalinijek = 0;
  19. while (sf.hasNextLine()) {
  20. liczbalinijek++;
  21. }
  22. String[] s = new String[liczbalinijek];
  23. for (int i = 0; sf.hasNextLine(); i++) {
  24. s[i] = sf.nextLine();
  25. System.out.println(s[i] + "/n");
  26. }
  27. if (s[0] == null) {
  28. System.out.println("There are no decks currentely created.");
  29. }
  30.  
  31. Scanner dn = new Scanner(System.in);
  32. for (int i = 0; i < liczbalinijek; i++) {
  33. File d = new File(getLoc() + "\\" + s[i] + ".txt");
  34. Scanner fl = new Scanner(d);
  35. int ll = 0;
  36. if (s[i].equals(dn.toString())) {
  37.  
  38. while (fl.hasNextLine())
  39. ll++;
  40. System.out.println(fl.nextLine() + "/n");
  41.  
  42. System.out.println(
  43. "Options:" + "/n1. Switch to the traditional view." + "/n2. Launch a matching app");
  44. Scanner flashcard = new Scanner(System.in);
  45. int fc = flashcard.nextInt();
  46. if (fc == 1) {
  47. Flashcard[] fclist = new Flashcard[ll];
  48. Deck deck = new Deck(dn.toString(), fclist);
  49. deck.setFclist(d); // Napisać to pózniej
  50. int y = 0;
  51. if (getB()) {
  52. System.out.println(fclist[y].getTerm() + "/n");
  53. } else {
  54. System.out.println(fclist[y].getDefinition() + "/n");
  55. }
  56. if (y == 0)
  57. System.out.println("/t/tNext");
  58. else if (y == ll)
  59. System.out.println("Previous");
  60. else
  61. System.out.println("Previous/t/tNext");
  62. Scanner trview = new Scanner(System.in);
  63. if (trview.toString().equals("Previous"))
  64. y--;
  65. if (trview.toString().equals("Next"))
  66. y++;
  67. if (trview.toString().equals("Show the other"))
  68. if (getB()) {
  69. System.out.println("/n" + fclist[y].getDefinition() + "/n");
  70. } else {
  71. System.out.println("/n" + fclist[y].getTerm() + "/n");
  72. }
  73. }
  74. }
  75. }
  76. }
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement