⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 book.java

📁 ssd3的教程 是我们老师给我们的 纯英文 有兴趣的可以
💻 JAVA
字号:
/*!Begin Snippet:file*/
/**
 * This class models a book. It extends {@link CatalogItem} and
 * adds the following information:
 * <ol>
 * <li>the author of the book, a <code>String</code></li>
 * <li>the number of pages in the book, an <code>int</code></li>
 * </ol>
 *
 * @author author name
 * @version  1.0.0
 * @see CatalogItem
 */
public class Book extends CatalogItem  {

	/* Author of the book.*/
	private String  author;

	/* Number of pages in the book.*/
	private int  numberOfPages;

	/**
	 * Constructs a <code>Book</code> object.
	 *
	 * @param initialCode  the code of the book.
	 * @param initialTitle  the title of the book.
	 * @param initialYear  the year the book was published.
	 * @param initialAuthor  the author of the book.
	 * @param initialNumberOfPages  the number of pages in the book.
	 */
	public Book(String initialCode, String initialTitle, int initialYear,
	            String initialAuthor, int initialNumberOfPages) {

		super(initialCode, initialTitle, initialYear);

		author = initialAuthor;
		numberOfPages = initialNumberOfPages;
	}

	/**
	 * Returns the author of this book.
	 *
	 * @return  the author of this book.
	 */
	public String  getAuthor()  {

		return  author;
	}

	/**
	 * Returns the number of pages in this book.
	 *
	 * @return  the number of pages in this book.
	 */
	public int  getNumberOfPages()  {

		return  numberOfPages;
	}

	/**
	 * Returns the string representation of this book.
	 *
	 * @return  the string representation of this book.
	 */
	public String toString()  {

		return  super.toString() + "_" + getAuthor() + "_"
		        + getNumberOfPages();
	}
}
/*!End Snippet:file*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -