📄 order.java
字号:
/**
* An Order Object encapsulates the information of an order made by a customerr.
* Order is the entity for OrderController to use. *
* This information includes:
* <ul>
* <li>order id
* <li>transit method of the order
* <li>transit address of the order, actuall we didn't do this in the application.
* <li>order's freight
* <li>order's total cost;
* <li>the time the order was made.
* <li>who make the order
* <li>products the order want.
* </ul>
*/
import java.util.*;
public class Order {
private int id;
private String method;
private String address;
private double freight;
private double money;
private String date;
private String customer;
private Vector products;
/**
* Set orderid.
*
* @param orderid the value of orderid
*/
public void setOrderid(int id){
this.id=id;
}
/**
* Set customer.
*
* @param customer the text of customer
*/
public void setCustomer(String customer){
this.customer=customer;
}
/**
* Set method.
*
* @param method the text of method
*/
public void setMethod(String method){
this.method=method;
}
/**
* Set address.
*
* @param address the text of address
*/
public void setAddress(String address){
this.address=address;
}
/**
* Set freight.
*
* @param freight the value of freight
*/
public void setFreight(double freight){
this.freight=freight;
}
/**
* Sets money.
*
* @param money the value of money
*/
public void setMoney(double money){
this.money=money;
}
/**
* Set products.
*
* @param products the contents of products
*/
public void setProducts(Vector products){
this.products=products;
}
/**
* Set date.
*
* @param date the value of date
*/
public void setDate(String date){
this.date=date;
}
/**
* Get orderid.
*
* @return the value of orderid
*/
public int getID(){
return this.id;
}
/**
* Get customer.
*
* @return the text of customer
*/
public String getCustomer(){
return this.customer;
}
/**
* Get address.
*
* @return the text of address
*/
public String getAddress(){
return this.address;
}
/**
* Get method.
*
* @return the text of method
*/
public String getMethod(){
return this.method;
}
/**
* Get freight.
*
* @return the value of freight
*/
public double getFreight(){
return this.freight;
}
/**
* Get money.
*
* @return the value of money
*/
public double getMoney(){
return this.money;
}
/**
* Get products.
*
* @return the content of products
*/
public Vector getProducts(){
return this.products;
}
/**
* Get date.
*
* @return the text of products
*/
public String getDate(){
return this.date;
}
/**
* the class' toString method.
*
* @return the text of the order's date
*/
public String toString(){
return this.date+"";
}
/**
* Get order's detail information.
*
* @return the detail information of the order contains:
* <ul>
* <li>orderid
* <li>order date
* <li>transit method of the order.
* <li>order's total cost
* <li>products the order want.
* </ul>
*/
public String getDetails(){
String str="OrderID: "+this.id+"\nDate: "+this.date+"\nTotal: "+this.money+"\nDelivery Method: "+this.method+"\n";
for(int i=0;i<products.size();i++){
Product p=(Product)products.get(i);
str+=p.getPurchasecount()+" "+p.getName()+"(s)\n";
}
return str;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -