Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Tester {
  4. public static void main(String[] args) {
  5. String title = "";
  6. String author = "";
  7. String id = "";
  8. String year = "";
  9. String length = "";
  10. String genre = "";
  11. String command = "";
  12.  
  13. // Constructors for the objects utilize all the methods
  14.  
  15. Scanner scanner = new Scanner(System.in);
  16. System.out.println("Creating Book...");
  17. System.out.print("Please input book title: ");
  18. title = scanner.nextLine();
  19. System.out.print("Please input book id: ");
  20. id = scanner.nextLine();
  21. System.out.print("Please input book author: ");
  22. author = scanner.nextLine();
  23. Book book = new Book(id, title, author);
  24.  
  25. System.out.println("");
  26. System.out.println("Creating Magazine...");
  27. System.out.print("Please input magazine title: ");
  28. title = scanner.nextLine();
  29. System.out.print("Please input magazine id: ");
  30. id = scanner.nextLine();
  31. System.out.print("Please input magazine year: ");
  32. year = scanner.nextLine();
  33. Magazine magazine = new Magazine(id, title, year);
  34.  
  35. System.out.println("");
  36. System.out.println("Creating Video...");
  37. System.out.print("Please input video title: ");
  38. title = scanner.nextLine();
  39. System.out.print("Please input video id: ");
  40. id = scanner.nextLine();
  41. System.out.print("Please input video length: ");
  42. length = scanner.nextLine();
  43. Video video = new Video(id, title, length);
  44.  
  45. System.out.println("");
  46. System.out.println("Creating CD...");
  47. System.out.print("Please input CD title: ");
  48. title = scanner.nextLine();
  49. System.out.print("Please input CD id: ");
  50. id = scanner.nextLine();
  51. System.out.print("Please input CD genre: ");
  52. genre = scanner.nextLine();
  53. CD cd = new CD(id, title, genre);
  54.  
  55. System.out.println("");
  56. System.out.println(book);
  57. System.out.println(magazine);
  58. System.out.println(cd);
  59. System.out.println(video);
  60.  
  61. scanner.close();
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement