Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Book
- {
- // The fields.
- private String author;
- private String title;
- private int pages;
- private String refNumber;
- /**
- * Set the author and title fields when this object
- * is constructed.
- */
- public Book(String bookAuthor, String bookTitle, int amountPages, String setRef)
- {
- if(setRef == null)
- {
- refNumber = "";
- author = bookAuthor;
- title = bookTitle;
- pages = amountPages;
- }
- if(setRef!= null)
- {
- refNumber = setRef;
- author = bookAuthor;
- title = bookTitle;
- pages = amountPages;
- }
- }
- public String returnAuthor()
- {
- return author;
- }
- public int getPages()
- {
- return pages;
- }
- public String returnTitle()
- {
- return title;
- }
- public void printAuthor()
- {
- System.out.println(author);
- }
- public void printTitle()
- {
- System.out.println(title);
- }
- public void printDetails()
- {
- System.out.println("Titel : " + title);
- System.out.println("Auteur : " + author);
- System.out.println("Aantal pagina's : " + pages);
Advertisement
Add Comment
Please, Sign In to add comment