创建Order实体类
package ordermsg;
public class Order {
private int orderId;
private String userName;
private String foodName;
private int foodNum;
private double totalPrice;
private String address;
private String time;
private int state;
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getFoodName() {
return foodName;
}
public void setFoodName(String foodName) {
this.foodName = foodName;
}
public int getFoodNum() {
return foodNum;
}
public void setFoodNum(int foodNum) {
this.foodNum = foodNum;
}
public double getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(double totalPrice) {
this.totalPrice = totalPrice;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
@Override
public String toString() {
return "Order{" +
"orderId=" + orderId +
", userName='" + userName + '\'' +
", foodName='" + foodName + '\'' +
", foodNum=" + foodNum +
", totalPrice=" + totalPrice +
", address='" + address + '\'' +
", time='" + time + '\'' +
'}';
}
}
创建OrderMsg类
package ordermsg;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Scanner;
public class OrderMsg {
public static void main(String[] args) {
ArrayList<Order> ordersList = new ArrayList<>();
//打印功能
OrderMsg.printFunction();
Scanner scanner = new Scanner(System.in);