设计一个图书类Book,该Book类具有属性:书籍编号(bookId),书名(bookName),作者(author),出版单位(publisher),单价(price)
public class Book {
private long bookId;
private String BookName;
private String author;
private String publisher;
private int price;
public Book(){
}
public Book(long bookId,String BookName,String author,String publisher,int price){
this.author=author;
this.bookId=bookId;
this.BookName=BookName;
this.price=price;
this.publisher=publisher;
}
public void show(){
System.out.println("书籍编号"+bookId);
System.out.println("书籍名"+BookName);
System.out.println("书籍作者"+author);
System.out.println("书籍价格"+price);
System.out.println("出版单位"+publisher);
}
public long getBookId() {
return bookId;
}
public void setBookId(long bookId) {
this.bookId = bookId;
}
public String getBookName() {
return BookName;
}
public void setBookName(String bookName) {
BookName = bookName;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
}
public class BookTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Book s1=new Book(10001,"高估尊是怎么炼成的","烟台大学出版社","高估尊",0);
s1.show();
}
}