Advertisement
Mary_Loskutova

Cicle

Mar 11th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. do {
  2.                     try {
  3.                         int input;
  4.                         input = sc.nextInt();
  5.                         switch (input) {
  6.                         case 1:
  7.                             player.finish();
  8.                             return;
  9.                         case 2:
  10.                             if (player.activeplaylists.size() != 0) {
  11.                                 System.out.print("Number of active playlists: " + player.activeplaylists.size() + "\n"
  12.                                         + "They are: ");
  13.                                 player.writePlaylists();
  14.                                                        
  15.                                 System.out.println("Enter the number:");
  16.                                 int number = sc.nextInt();
  17.                                 player.stopPlaylist(number);
  18.                                 return;
  19.                             } else {
  20.                                 System.out.println("There are no active playlists");
  21.                             }
  22.                         case 3:
  23.                             return;
  24.                         default:
  25.                             System.out.print("Wrong input!" + "\n");
  26.                             break;
  27.                         }
  28.                     } catch (InputMismatchException ex) {
  29.                         System.out.print("Wrong input!");
  30.                         ;
  31.                     }
  32.                 } while (true);
  33.             }
  34.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement