book.java

来自「大学java作业源程序」· Java 代码 · 共 69 行

JAVA
69
字号
package problem_10;
//Book.java
//书类
public class Book {
	private String title;		//书名
	private String author;		//作者
	private String press;		//出版社
	private String date;		//出版时间
	private double price;		//价格
	
	public Book(String title, String author, String press, String date, double price){
		this.title = title;
		this.author = author;
		this.press = press;
		this.date = date;
		this.price = price;
	}
	
	//返回书名
	public String getTitle(){
		return title;
	}
	
	//返回作者
	public String getAuthor(){
		return author;
	}
	
	//返回出版社
	public String getPress(){
		return press;
	}
	
	//返回出版日期
	public String getDate(){
		return date;
	}
	
	//返回价格
	public double getPrice(){
		return price;
	}
	
	//设置书名
	public void setTitle(String title){
		this.title = title;
	}
	
	//设置作者
	public void setAuthor(String author){
		this.author = author;
	}
	
	//设置出版社
	public void setPress(String press){
		this.press = press;
	}
	
	//设置出版时间
	public void setDate(String date){
		this.date = date;
	}
	
	//设置价格
	public void setPrice(double price){
		this.price = price;
	}
}

⌨️ 快捷键说明

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