Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. public void newFilmsTxt() throws IOException//Για την ContentΑdmins
  2. {
  3. PrintWriter pw = new PrintWriter(new FileWriter("films.txt", true));
  4. boolean check;
  5. do
  6. {
  7. check=true;
  8. try
  9. {
  10. System.out.println("Insert film ID");
  11. filmID = sc.nextInt();
  12. }
  13. catch(InputMismatchException e)
  14. {
  15. System.out.println("Film ID must be an integer.");
  16. check=false;
  17. }
  18. finally
  19. {
  20. sc.nextLine();
  21. }
  22. } while (check!=true);
  23. CheckFilmID(filmID);
  24. pw.println(filmID);
  25.  
  26. System.out.println("Insert film title");
  27. filmTitle = sc.nextLine();
  28. pw.println(filmTitle);
  29.  
  30. System.out.println("Insert film category");
  31. filmCategory = sc.nextLine();
  32. pw.println(filmCategory);
  33.  
  34. System.out.println("Insert film description");
  35. filmDescription = sc.nextLine();
  36. pw.println(filmDescription);
  37.  
  38. System.out.println("Insert film price");
  39. do
  40. {
  41. check=true;
  42. try
  43. {
  44. price = sc.nextInt();
  45. }
  46. catch(InputMismatchException e)
  47. {
  48. System.out.println("Price must be an integer.");
  49. check=false;
  50. }
  51. finally
  52. {
  53. sc.nextLine();
  54. }
  55. } while (check!=true);
  56. CheckFilmPrice(price);
  57. pw.println(price);
  58.  
  59. pw.close();
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement