📄 orderitem.java
字号:
public class OrderItem {
private Product product;
private int quantity;
public OrderItem(Product initialProduct, int initialQuantity) {
this.product = initialProduct;
this.quantity = initialQuantity;
}
public void setQuantity(int newQuantity) {
this.quantity = newQuantity;
}
public int getQuantity() {
return this.quantity;
}
public Product getProduct(){
return this.product;
}
public double getValue() {
return this.getQuantity() * product.getPrice();
}
public String toString() {
return this.getQuantity() + " " + product.getCode() + " " +
product.getPrice();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -