Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.74 KB | None | 0 0
  1. //Kevin Chavez
  2. public class Book
  3. {
  4.  
  5.       private String title;
  6.       private String author;
  7.       private String publisher;
  8.       private String isbn;
  9.       private double price;
  10.  
  11.       public Book()
  12.       {
  13.             setTitle("");
  14.             setAuthor("");
  15.             setIsbn("");
  16.             setPublisher("");
  17.             setPrice(0.0);
  18.  
  19.       }
  20.       public Book(String title, String author, String publisher, String isbn, Double price)
  21.       {
  22.  
  23.  
  24.         setTitle(title);
  25.         setAuthor(author);
  26.         setPublisher(publisher);
  27.         setIsbn(isbn);
  28.         setPrice(price);
  29.  
  30.       }
  31.       public void setTitle(String title)
  32.       {
  33.             this.title = title;
  34.       }
  35.       public String getTitle()
  36.       {
  37.             return title;
  38.       }
  39.       public void setAuthor(String author)
  40.       {
  41.             this.author = author;
  42.       }
  43.       public String getAuthor()
  44.       {
  45.             return author;
  46.       }
  47.       public void setPublisher(String publisher)
  48.       {
  49.             this.publisher = publisher;
  50.       }
  51.       public String getPublisher()
  52.       {
  53.             return publisher;
  54.       }
  55.       public void setIsbn(String isbn)
  56.       {
  57.             this.isbn = isbn;
  58.       }
  59.       public String getIsbn()
  60.       {
  61.             return isbn;
  62.       }
  63.       public void setPrice(double price)
  64.       {
  65.             this.price = price;
  66.       }
  67.       public double getPrice()
  68.       {
  69.             return price;
  70.       }
  71.  
  72.       public String toString()
  73.       {
  74.             return("Title" + title + "Author" + author + "ISBN" + isbn + "Publisher" + publisher + "Price" + price);
  75.       }
  76.       public double calculate_charge(int quantity)
  77.       {
  78.             return(quantity * price);
  79.       }
  80.  
  81.  
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement