Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. public class Genre(){
  2. private string genre;
  3. //The constructor which takes parameter genre and assigns to genre;
  4. //The respective getters, setters and toString function;
  5. }
  6.  
  7. public class Catalogue(){
  8. private List<Book> booksAvailable;
  9. private List<Genre> genres;
  10. public Catalogue(){
  11. this.genres = new LinkedList<Genre>();
  12.  
  13. booksAvailable.add(new Book("Swift", 1999, new Genre("Programming"),20));
  14. booksAvailable.add(new Book("TheAlChemist", 2000, new Genre("Drama"),20));
  15. //Name of a book, year of publication, genre, price
  16. }
  17. public void getGenre(){
  18. System.out.println("I am outside the for loop so I will get printed");
  19. for (Genre genre : genres){
  20. System.out.println("I am inside the fo each loop so I will not get printed.");
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement