Package bookstore
Class Book
java.lang.Object
bookstore.Book
Represents a book
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the value of the author fieldgetName()Gets the value of the name fielddoublegetPrice()Gets the value of the price fieldintgetStock()Gets the value of the stock fieldvoidAssigns the given value to the author fieldvoidAssigns the given value to the name fieldvoidsetPrice(double price) Assigns the given value to the price fieldvoidsetStock(int stock) Assigns the given value to the stock field
-
Constructor Details
-
Book
Book constructor- Parameters:
name- the book's titleauthor- the author of the bookprice- the price of the bookstock- number of copies in stock
-
-
Method Details
-
getAuthor
Gets the value of the author field- Returns:
- the value of author
-
setAuthor
Assigns the given value to the author field- Parameters:
author- the author
-
getName
Gets the value of the name field- Returns:
- the value of name
-
setName
Assigns the given value to the name field- Parameters:
name- the name
-
getPrice
public double getPrice()Gets the value of the price field- Returns:
- the value of price
-
setPrice
public void setPrice(double price) Assigns the given value to the price field- Parameters:
price- the price
-
getStock
public int getStock()Gets the value of the stock field- Returns:
- the value of stock
-
setStock
public void setStock(int stock) Assigns the given value to the stock field- Parameters:
stock- the stock
-