1. 程式人生 > >手擼一個外賣點餐系統後臺,可以寫上簡歷的實戰專案!

手擼一個外賣點餐系統後臺,可以寫上簡歷的實戰專案!

## 外賣點餐系統的實現 ## 實體類的編寫 (1)菜品類(菜品id,菜品名,菜品型別,上架時間,單價,月銷售,總數量) ``` import java.util.Date; public class Menu { private String mid; private String name; private String type; private Date dateIssued; private double price; private int monthlySales; private int totalQuantity; public Menu() { super(); // TODO Auto-generated constructor stub } public Menu(String mid, String name, String type, Date dateIssued, double price, int monthlySales, int totalQuantity) { super(); this.mid = mid; this.name = name; this.type = type; this.dateIssued = dateIssued; this.price = price; this.monthlySales = monthlySales; this.totalQuantity = totalQuantity; } public String getMid() { return mid; } public void setMid(String mid) { this.mid = mid; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Date getDateIssued() { return dateIssued; } public void setDateIssued(Date dateIssued) { this.dateIssued = dateIssued; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getMonthlySales() { return monthlySales; } public void setMonthlySales(int monthlySales) { this.monthlySales = monthlySales; } public int getTotalQuantity() { return totalQuantity; } public void setTotalQuantity(int totalQuantity) { this.totalQuantity = totalQuantity; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dateIssued == null) ? 0 : dateIssued.hashCode()); result = prime * result + ((mid == null) ? 0 : mid.hashCode()); result = prime * result + monthlySales; result = prime * result + ((name == null) ? 0 : name.hashCode()); long temp; temp = Double.doubleToLongBits(price); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + totalQuantity; result = prime * result + ((type == null) ? 0 : type.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Menu other = (Menu) obj; if (dateIssued == null) { if (other.dateIssued != null) return false; } else if (!dateIssued.equals(other.dateIssued)) return false; if (mid == null) { if (other.mid != null) return false; } else if (!mid.equals(other.mid)) return false; if (monthlySales != other.monthlySales) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (Double.doubleToLongBits(price) != Double.doubleToLongBits(other.price)) return false; if (totalQuantity != other.totalQuantity) return false; if (type == null) { if (other.type != null) return false; } else if (!type.equals(other.type)) return false; return true; } @Override public String toString() { return "Menu [mid=" + mid + ", name=" + name + ", type=" + type + ", dateIssued=" + dateIssued + ", price=" + price + ", monthlySales=" + monthlySales + ", totalQuantity=" + totalQuantity + "]"; } } ``` ``` import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; import java.util.Set; import java.util.stream.Collectors; public class MenuManager implements DAO { static Ma