Ghislain_Mike

Book.java

Oct 20th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. public class Book {
  2.     private String title, author;
  3.     private int pages;
  4.     private boolean referenceBook;
  5.    
  6.     public Book(String title, String author, int pages, boolean referenceBook) {
  7.         this.title = title;
  8.         this.author = author;
  9.         this.pages = pages;
  10.         this.referenceBook = referenceBook;
  11.     }
  12.    
  13.     public Book(boolean referenceBook, int pages, String author, String title) {
  14.         this.referenceBook = referenceBook;
  15.         this.pages = pages;
  16.         this.author = author;
  17.         this.title = title;
  18.     }
  19.    
  20.     public void printBookInfo() {
  21.         System.out.println("Book Title: " + title);
  22.         System.out.println("Book Author: " + author);
  23.         System.out.println("Number of Pages: " + pages);
  24.         System.out.println("Reference Book: " + referenceBook);
  25.        
  26.         System.out.println("\n");
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment