📄 cartitembean.java
字号:
package org.sunxin.lesson.jsp.bookstore;
import java.io.Serializable;
public class CartItemBean implements Serializable
{
private BookBean book=null;
//表示选购的图书的数量
private int quantity=0;
public CartItemBean()
{
}
public CartItemBean(BookBean book)
{
this.book=book;
this.quantity=1;
}
public void setBook(BookBean book)
{
this.book = book;
}
public BookBean getBook()
{
return book;
}
public void setQuantity(int quantity)
{
this.quantity = quantity;
}
public int getQuantity()
{
return quantity;
}
/**
*得到本条目所购图书价格的合计,总价 = 图书的单价 * 数量。
*/
public float getItemPrice()
{
float price=book.getPrice()*quantity;
long val=Math.round(price*100);
return val/100.0f;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -