Advertisement
Sothian

Untitled

Nov 22nd, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1. // CATEGORIES TEST
  2.         File file;
  3.         Scanner scan= new Scanner(System.in);
  4.         // Test the categories by typing "Yes"
  5.         System.out.println("Do you want to see categories of offenses? Press 'Yes' to see.");
  6.         String checkAttachements = scan.nextLine();
  7.         if(checkAttachements=="Yes") {
  8.             do {
  9.                 // Test the categories by choosing attachement
  10.                 System.out.println("Choose attachement 1-5 (Type 1,2,3,4 or 5) to see categories in it");
  11.                 int attachement = scan.nextInt();
  12.                 switch(attachement) {
  13.                 case 1:
  14.                     file = new File("zalacznik1.txt");
  15.                     readFile(file);
  16.                     break;
  17.                 case 2:
  18.                     file = new File("zalacznik2.txt");
  19.                     readFile(file);
  20.                     break;
  21.                 case 3:
  22.                     file = new File("zalacznik3.txt");
  23.                     readFile(file);
  24.                     break;
  25.                 case 4:
  26.                     file = new File("zalacznik4.txt");
  27.                     readFile(file);
  28.                     break;
  29.                 case 5:
  30.                     file = new File("zalacznik5.txt");
  31.                     readFile(file);
  32.                     break;
  33.                 default:
  34.                     System.out.println("Unknown attachement");
  35.                     break;
  36.                 }
  37.                 System.out.println("Stop or again? Press Exit if you want to stop or No if not");
  38.                 checkAttachements = scan.nextLine();
  39.             } while(checkAttachements!="Exit");
  40.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement