开发一个表示图书的Book类

时间:2025-03-10 16:59:19
package com.base; public class Book { private int bookNumber; //编号 private String bookName; //书名 private String author; //作者 private double price; //价格 private String publication; //出版社 private String date; //出版日期 public int getBookNumber() { return bookNumber; } public void setBookNumber(int bookNumber) { this.bookNumber = bookNumber; } public String getBookName() { return bookName; } public void setBookName(String bookName) { this.bookName = bookName; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public String getPublication() { return publication; } public void setPublication(String publication) { this.publication = publication; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String show() { return "编号:"+bookNumber+",书名:"+bookName+",作者:"+author+",价格:"+price+",出版社:"+publication+",出版日期:"+date; } //修改价格 public void updatePrice (double price) { this.price=this.price+price; } }