tw.com.javaworld.CH10.Book (Java2HTML)

| Book.java |

    1 package tw.com.javaworld.CH10;
    2
    3 public class Book {
    4
    5     public Book() {
    6         name = "";
    7         author = "";
    8         publisher = "";
    9         price = 0;
    10        quantity = 0;
    11    }
    12
    13    private String name;
    14    private String author;
    15    private String publisher;
    16    private float price;
    17    private int quantity;
    18
    19    public String getName() {
    20        return name;
    21    }
    22    public String getAuthor() {
    23        return author;
    24    }
    25    public String getPublisher() {
    26        return publisher;
    27    }
    28    public void setPrice(float newPrice) {
    29        price = newPrice;
    30    }
    31    public float getPrice() {
    32        return price;
    33    }
    34    public void setQuantity(int newQuantity) {
    35        quantity = newQuantity;
    36    }
    37    public int getQuantity() {
    38        return quantity;
    39    }
    40    public void setPublisher(String newPublisher) {
    41        publisher = newPublisher;
    42    }
    43    public void setAuthor(String newAuthor) {
    44        author = newAuthor;
    45    }
    46    public void setName(String newName) {
    47        name = newName;
    48    }
    49}