📄 sale.java
字号:
/**
* @name Sale.java
* @version 1.0
* @author Administrator/pan
* @date 2009/2/11
*/
package com.digitstore.process;
import java.util.Date;
public class Sale {
//时间
private Date date;
//是否购物完成
private boolean isCompleted;
//所属用户
private Customer customer;
//购物车
private Cart cart;
//账单
private Payment payment;
//订单
private OrderForm orderForm;
//构造函数
private Sale(){//购物必须传入客户,标记唯一客户。
date = new Date();
isCompleted = false;
}
public Sale(Customer customer){
date = new Date();
isCompleted = false;
this.customer = customer;
cart = new Cart();
}
//对应的get/set方法
public Date getDate(){
return date;
}
public void setDate(Date date){
this.date = date;
}
public boolean getIscompleted(){
return isCompleted;
}
public void setIscompleted(boolean isCompleted){
this.isCompleted = isCompleted;
}
public Customer getCustomer(){
return customer;
}
public void setCustomer(Customer customer){
this.customer = customer;
}
public Cart getCart(){
return cart;
}
public void setCart(Cart cart){
this.cart = cart;
}
public Payment getPayment(){
return payment;
}
public void setPayment(Payment payment){
this.payment = payment;
}
public OrderForm getOrderForm(){
return orderForm;
}
public void setOrderForm(OrderForm orderForm){
this.orderForm = orderForm;
}
//购物完毕的设置方法
public void becomeCompleted(){
this.isCompleted = true;
}
//添加物品
public void makeLineItem(ProductSpecification prodSpec, int quantity){
SalesLineItem sLI = new SalesLineItem(prodSpec, quantity);
cart.addSalesLineItem(sLI);
}
//支付商品款项
public void makePayment(){
payment = new Payment();
}
//填写表单
public void makeOrderForm(){
orderForm = new OrderForm();
}
//算总账
public double getTotal(){
return cart.getTotal();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -