[project actual combat] is too powerful, Java takeout order primary system [source code attached]

Spiderman can't fly 2021-01-20 23:05:56
project actual combat powerful java


Stupid takeaway order system ------( No database )

tips

  • Dishes ( variety of dishes id, Dish name , Dish type , Shelf time , The unit price , Monthly sales , Total quantity )
  • Manager class ( Administrators id, account number , password )
  • Customer class ( Customer id, Customer name , Gender , password , Delivery address , cell-phone number , Creation time )
  • Order class ( The order number , Order creation time , variety of dishes id, Number of purchases , Customer id, Total price , The order status )
    explain :
  1. You can design your own data types for dish types (int or String), Such as 1: Noodle & Pastries 2: Steamed Rice 3: Hunan cuisine …
  2. When the dishes are on the shelves 、 Customer creation time 、 The order creation time automatically allocates the system time according to the addition time
  3. The order status type is int(0: Did not pay 1: Paid 2: In delivery 3: Completed )
    The following functions are required :
  4. Realize different roles of user login system
    (1) The administrator logs into the system and sees the following menu :
    ① Add dishes
    ② Check out all the food information ( Including paging function )
    ③ View the food information of the specified category
    ④ According to the dishes id Change the price of dishes
    ⑤ Delete the specified id The dishes
    ⑥ Add customers
    ⑦ Check out the list of customers
    ⑧ Delete the specified id The customer
    ⑨ The order list shows
    ⑩ According to the order id Modify order status
    11 sign out
    (2) The customer logs in and sees the following menu :
    ① Show all dishes ( The output is sorted from high to low according to the sales volume of dishes )
    --------> Order ( Input dishes id And the number of purchases )
    ② Display all dishes according to the dish category
    ③ View all orders ( Current login user's )
    ④ Change Password ( Current login user's )
    ⑤ Personal information display

That's all , First, we can build an interface , It is convenient to operate the four management classes ;

package com.softeem.lesson23.test2;
import java.util.List;
public interface DAO<T> {
void insert(T t);
T findById(String id);
List<T> findAll();
void delete(String id);
}

One 、 And then according to the requirements , First, set up the attribute classes of the four classes :
1.Admin class ( Manager class )

package com.softeem.lesson23.test2;
public class Admin {
private String aID;
private String account;
private String apwd;
public Admin() {
// TODO Auto-generated constructor stub
}
public Admin(String aID, String account, String apwd) {
super();
this.aID = aID;
this.account = account;
this.apwd = apwd;
}
public String getaID() {
return aID;
}
public void setaID(String aID) {
this.aID = aID;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getApwd() {
return apwd;
}
public void setApwd(String apwd) {
this.apwd = apwd;
}
@Override
public String toString() {
return "Admin [aID=" + aID + ", account=" + account + ", apwd=" + apwd + "]";
}
}

2.Dishes class ( Dishes )

package com.softeem.lesson23.test2;
import java.time.LocalDate;
public class Dishes {
private String dID;
private String dname;
private String dtype;
private LocalDate dtime;
private double price;
private int dsales;
private int dstocks;
public Dishes() {
// TODO Auto-generated constructor stub
}
public Dishes(String dID, String dname, String dtype, LocalDate dtime, double price, int dsales, int dstocks) {
super();
this.dID = dID;
this.dname = dname;
this.dtype = dtype;
this.dtime = dtime;
this.price = price;
this.dsales = dsales;
this.dstocks = dstocks;
}
public String getdID() {
return dID;
}
public void setdID(String dID) {
this.dID = dID;
}
public String getDname() {
return dname;
}
public void setDname(String dname) {
this.dname = dname;
}
public String getDtype() {
return dtype;
}
public void setDtype(String dtype) {
this.dtype = dtype;
}
public LocalDate getDtime() {
return dtime;
}
public void setDtime(LocalDate dtime) {
this.dtime = dtime;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getDsales() {
return dsales;
}
public void setDsales(int dsales) {
this.dsales = dsales;
}
public int getDstocks() {
return dstocks;
}
public void setDstocks(int dstocks) {
this.dstocks = dstocks;
}
@Override
public String toString() {
return "Dishes [ variety of dishes id:" + dID + ", Dish name :" + dname + ", Dish type :" + dtype + ", Shelf time :" + dtime + ", The unit price :" + price
+ ", In sales :" + dsales + ", Total quantity :" + dstocks + "]";
}
}

3.Order class ( Order class )

package com.softeem.lesson23.test2;
import java.time.LocalDateTime;
public class Order {
private String OrderID;
private LocalDateTime utime;
private Dishes dishes;
private int Ordernum;
private String uID;
private Double Orderprice;
private int OrderValue;
public Order() {
// TODO Auto-generated constructor stub
}
public Order(String orderID, LocalDateTime utime, Dishes dishes, int ordernum, String uID, Double orderprice,
int orderValue) {
super();
OrderID = orderID;
this.utime = utime;
this.dishes = dishes;
Ordernum = ordernum;
this.uID = uID;
Orderprice = orderprice;
OrderValue = orderValue;
}
public String getOrderID() {
return OrderID;
}
public void setOrderID(String orderID) {
OrderID = orderID;
}
public LocalDateTime getUtime() {
return utime;
}
public void setUtime(LocalDateTime utime) {
this.utime = utime;
}
public Double getOrderprice() {
return Orderprice;
}
public void setOrderprice(Double orderprice) {
Orderprice = orderprice;
}
public Dishes getDishes() {
return dishes;
}
public void setDishes(Dishes dishes) {
this.dishes = dishes;
}
public int getOrdernum() {
return Ordernum;
}
public void setOrdernum(int ordernum) {
Ordernum = ordernum;
}
public String getuID() {
return uID;
}
public void setuID(String uID) {
this.uID = uID;
}
public int getOrderValue() {
return OrderValue;
}
public void setOrderValue(int orderValue) {
OrderValue = orderValue;
}
@Override
public String toString() {
return "Order [OrderID=" + OrderID + ", utime=" + utime + ", dishes=" + dishes + ", Ordernum=" + Ordernum
+ ", uID=" + uID + ", Orderprice=" + Orderprice + ", OrderValue=" + OrderValue + "]";
}
}

4.User class ( User class )

package com.softeem.lesson23.test2;
import java.time.LocalDateTime;
public class User {
private String uID;
private String uname;
private String usex;
private String upwd;
private String uadress;
private String utel;
private LocalDateTime utime;
public User() {
// TODO Auto-generated constructor stub
}
public User(String uID, String uname, String usex, String upwd, String uadress, String utel, LocalDateTime utime) {
super();
this.uID = uID;
this.uname = uname;
this.usex = usex;
this.upwd = upwd;
this.uadress = uadress;
this.utel = utel;
this.utime = utime;
}
public String getuID() {
return uID;
}
public void setuID(String uID) {
this.uID = uID;
}
public String getUname() {
return uname;
}
public void setUname(String uname) {
this.uname = uname;
}
public String getUsex() {
return usex;
}
public void setUsex(String usex) {
this.usex = usex;
}
public String getUpwd() {
return upwd;
}
public void setUpwd(String upwd) {
this.upwd = upwd;
}
public String getUadress() {
return uadress;
}
public void setUadress(String uadress) {
this.uadress = uadress;
}
public String getUtel() {
return utel;
}
public void setUtel(String utel) {
this.utel = utel;
}
public LocalDateTime getUtime() {
return utime;
}
public void setUtime(LocalDateTime utime) {
this.utime = utime;
}
@Override
public String toString() {
return "User [uID=" + uID + ", uname=" + uname + ", usex=" + usex + ", upwd=" + upwd + ", uadress=" + uadress
+ ", utel=" + utel + ", utime=" + utime + "]";
}
}

There's no difficulty in this step , Just set each property , Then set it to private , Note the data type of the attribute , This is very important , It is convenient for later management class to operate it .
Two 、 Property management class
This is the whole demo A rare place , My idea is to build Admin Property management class ,Order Property management class ,Dishes Attribute class ,User Property management class , And then Admin Attribute management class Order Property management class ,Dishes Attribute class ,User Property management class first new come out , then , Each property management class implements its own method , Only need Admin The method of calling each attribute management class in the attribute management class , Can be achieved through Admin Class manages the data of other classes , however , Each class needs to build a Map aggregate , Store individual elements , Note here that each property management class Map Key Convenient for later period Map To operate , Then create a menu class , Regulations User and Admin Methods that can be called .
Don't talk much , Go straight to the code , Now the code is through Admin Management is an extension of , So first look at Admin Management category .
1.Admin Management category

package com.softeem.lesson23.test2;
import java.time.LocalDate;
import java.time.LocalDateTime;
//import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
//import java.util.Set;
public class AdminSys implements DAO<Admin> {
static Map<String, Admin> map = new HashMap<>();
// static Set<String> keys = map.keySet();
UserSys u = new UserSys();
OrderSys o = new OrderSys();
DishesSys d = new DishesSys();
Scanner sc = new Scanner(System.in);
/**
* Add dishes
*/
public void addDishes() {
System.out.println(" Please input the dish you want to add :( according to : variety of dishes ID/ Dish name / Dish type / The unit price / In sales / Total quantity )");
String str = sc.next();
String[] info = str.split("/");
//
if (info.length < 6) {
System.out.println(" Oh, my God , Input failed , Please re-enter !");
addDishes();
} else {
LocalDate dtime = LocalDate.now();
Dishes t = new Dishes(info[0], info[1], info[2], dtime, Double.parseDouble(info[3]),
Integer.parseInt(info[4]), Integer.parseInt(info[5]));
d.insert(t);
System.out.println(" The little Lord , congratulations ! Added successfully ");
}
}
/**
* Check out all the food information ( Including paging function )
*/
public void showAllDishes(int pageSize) {
List<Dishes> list = d.findAll();
int start = 0;
// Write a dead loop first , Get into else after break fall
while (true) {
if (list.size() > (pageSize + start)) {
System.out.println(list.subList(start, pageSize + start));
} else {
System.out.println(list.subList(start, list.size()));
break;
}
start = start + pageSize;
}
}
/**
* View the food information of the specified category
*
*/
public void selecBytypeOfAdmin() {
System.out.println(" Please enter the category of dishes you want to query :");
String typename = sc.next();
d.selectBytype(typename);
}
/**
* According to the dishes id Change the price of dishes
*/
public void selectByDishesID() {
System.out.println(" Please input the dishes you want to query id:");
String id = sc.next();
Dishes dish = d.findById(id);
if (dish == null) {
System.out.println(" No current id What about our dishes ");
} else {
System.out.println(" The current dish is :" + dish);
System.out.println(" Please enter the unit price of the new dish :");
double newprice = sc.nextDouble();
Dishes t = new Dishes(dish.getdID(), dish.getDname(), dish.getDtype(), dish.getDtime(), newprice,
dish.getDsales(), dish.getDstocks());
d.insert(t);
System.out.println(" Modification successful " + d.findById(t.getdID()));
}
}
/**
* Delete the specified id The dishes
*
* @param args
*/
public void deleteDishes() {
System.out.println(" Please enter the dish you want to delete id");
String id = sc.next();
d.delete(id);
System.out.println(" Delete successful !!");
}
/**
* Add customers
*/
public void addUser() {
System.out.println(" Please enter the user you want to add : according to (id/ full name / Gender / password / Delivery address / cell-phone number )");
String str = sc.next();
String[] info = str.split("/");
if (info.length < 6) {
System.out.println(" The information you entered is wrong , Please re-enter ....");
addUser();
} else {
LocalDateTime utime = LocalDateTime.now();
u.insert(new User(info[0], info[1], info[2], info[3], info[4], info[5], utime));
System.out.println(" Add success ");
}
}
/**
* Check out the list of customers
*/
public void findUser() {
List<User> userlist = u.findAll();
for (User user : userlist) {
System.out.println(user);
}
}
/**
* according to id Find the specified user
*/
public User findUserByid(String id) {
return u.findById(id);
}
/**
* Delete the specified id The customer
*/
public void deleteUserByAdmin() {
System.out.println(" Please enter the id:");
String id = sc.next();
u.delete(id);
}
/**
* The order list shows
*/
public void showAllOrder() {
List<Order> allOrder = o.findAll();
for (Order order : allOrder) {
System.out.println(order);
}
}
/**
* According to the order id Modify order status
*/
public void changeOrderValue() {
System.out.println(" Please enter the order whose status you want to modify id");
String id = sc.next();
Order order = o.findById(id);
if (order == null) {
System.out.println(" No current id The order of , Please check the input ");
} else {
System.out.println(" Found current id Order " + order);
System.out.println(" Please enter the status you want to modify :0: Did not pay 1: Paid 2: In delivery 3: Completed ");
int value = sc.nextInt();
Order t = new Order(order.getOrderID(), order.getUtime(), order.getDishes(), order.getOrdernum(),
order.getuID(), order.getOrderprice(), value);
o.insert(t);
System.out.println(" The modification was successful !!!");
}
}
/**
* Show all dishes ( The output is sorted from high to low according to the sales volume of dishes )
*/
public void showAllDishesByUser() {
List<Dishes> list = d.findAll();
Collections.sort(list, (p1, p2) -> p1.getDsales() - p2.getDsales());
System.out.println(list);
}
/**
* Order ( Input dishes id And the number of purchases )
*/
public void shopDishes(User user) {
showAllDishesByUser();
System.out.println(" Please enter what you want to buy id And quantity : according to (id/ Number )");
String str = sc.next();
String[] info = str.split("/");
// Judge whether the input meets the requirements , If it doesn't meet the requirements, it is required to re-enter
if (info.length < 2) {
System.out.println(" Incorrect input , Please re-enter :");
shopDishes(user);
} else {
LocalDateTime l = LocalDateTime.now();
// String orderID, LocalDateTime utime, Dishes dishes, int ordernum, String uID,
// Double orderprice,int orderValue
Order t = new Order(info[0], l, d.findById(info[0]), Integer.parseInt(info[1]), user.getuID(),
o.findById(info[0]).getOrderprice(), o.findById(info[0]).getOrderValue());
o.insert(t);
System.out.println(" Order generated !!!" + o.findById(info[0]));
}
}
/**
* Display all dishes according to the dish category
*/
public void ShowOfTypeByUser() {
System.out.println(" Please enter the category you want to find :");
String str = sc.next();
System.out.println(d.findByType(str));
}
/**
* View all orders ( Current login user's )
*/
public void showAllOrderByUser(User user) {
List<Order> list = o.findByuId(user.getuID());
for (Order order : list) {
System.out.println(order);
}
}
/**
* Change Password ( Current login user's )
*/
public void changePwdByUser(User user) {
u.changepwd(user.getuID());
System.out.println(" Modification successful !!");
}
/**
* Personal information display
*/
public void showByUser(User user) {
User findById = u.findById(user.getuID());
System.out.println(findById);
}
// Functions to be added , Delete Administrator
@Override
public void delete(String id) {
}
// Functions to be added , Add Administrator
@Override
public void insert(Admin t) {
// TODO Auto-generated method stub
}
// Functions to be added , adopt id That is, the account search administrator
@Override
public Admin findById(String id) {
return map.get(id);
}
// Functions to be added , Show all administrators
@Override
public List<Admin> findAll() {
// TODO Auto-generated method stub
return null;
}
// Set the system default data first
public void addMessage() {
map.put("qwl", new Admin("10086", "qwl", "123456"));
LocalDate time = LocalDate.now();
Dishes d1 = new Dishes("1", " Braised Pork Trotter with Soya Sauce ", " meat ", time, 12.5, 20, 30);
d.insert(d1);
Dishes d2 = new Dishes("2", " Chicken pot ", " meat ", time, 21.5, 30, 20);
d.insert(d2);
Dishes d3 = new Dishes("3", " Spicy hot pot ", " Hot pot ", time, 30, 5, 10);
d.insert(d3);
Dishes d4 = new Dishes("4", " Boiled meat ", " meat ", time, 15, 12, 15);
d.insert(d4);
Dishes d5 = new Dishes("5", " Fresh Fruit Salad ", " Fruits ", time, 6, 70, 60);
d.insert(d5);
// String orderID, LocalDateTime utime, Dishes dishes, int ordernum, String uID,
// Double orderprice,int orderValue
LocalDateTime localdatetime = LocalDateTime.now();
Order o1 = new Order("1", localdatetime, d1, 10, "1001", 60.0, 1);
o.insert(o1);
Order o2 = new Order("2", localdatetime, d2, 5, "1002", 50.0, 10);
o.insert(o2);
Order o3 = new Order("3", localdatetime, d3, 5, "1003", 40.0, 5);
o.insert(o3);
Order o4 = new Order("4", localdatetime, d4, 5, "1004", 30.0, 6);
o.insert(o4);
Order o5 = new Order("5", localdatetime, d5, 5, "1005", 20.0, 8);
o.insert(o5);
// String uID, String uname, String usex, String upwd, String uadress, String
// utel, LocalDateTime utime
User u1 = new User("1001", " Zhang San ", " male ", "123456", " hubei ", "13545286487", localdatetime);
u.insert(u1);
User u2 = new User("1002", " Li Si ", " male ", "234567", " hunan ", "15927948976", localdatetime);
u.insert(u2);
User u3 = new User("1003", " Wang Wu ", " male ", "345678", " jiangsu ", "15927986854", localdatetime);
u.insert(u3);
User u4 = new User("1004", " Liu Liu ", " Woman ", "456789", " Zhejiang ", "18771580860", localdatetime);
u.insert(u4);
User u5 = new User("1005", " Zhao Qi ", " Woman ", "567890", " xinjiang ", "18771580750", localdatetime);
u.insert(u5);
}
}

2.Order Property management class

package com.softeem.lesson23.test2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
public class OrderSys implements DAO<Order> {
static Map<String, Order> ordermap = new HashMap<>();
static List<Order> orderlist = new ArrayList<>();
/**
* New order
*/
@Override
public void insert(Order t) {
ordermap.put(t.getOrderID(), t);
}
/**
* By order id Search for orders
*/
@Override
public Order findById(String id) {
if (ordermap.get(id) == null) {
return null;
} else {
return ordermap.get(id);
}
}
/**
* Through users id Query all orders of users , And return a list aggregate
* @param uid
* @return
*/
public List<Order> findByuId(String uid) {
List<Order> list = new ArrayList<>();
Set<String> keys = ordermap.keySet();
for (String key : keys) {
if (Objects.equals(uid, ordermap.get(key).getuID())) {
list.add(ordermap.get(key));
}
}
return list;
}
/**
* Show all orders
*/
@Override
public List<Order> findAll() {
Set<String> keys = ordermap.keySet();
for (String key : keys) {
orderlist.add(ordermap.get(key));
}
return orderlist;
}
/**
* Functions to be completed , Delete order
*/
@Override
public void delete(String id) {
// TODO Auto-generated method stub
}
}

3.User Property management class

package com.softeem.lesson23.test2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
// Customer id, Customer name , Gender , password , Delivery address , cell-phone number , Creation time
public class UserSys implements DAO<User> {
static Map<String, User> usermap = new HashMap<>();
List<User> list = new ArrayList<>();
Scanner sc = new Scanner(System.in);
/**
* Add customers
*/
@Override
public void insert(User t) {
usermap.put(t.getuID(), t);
}
/**
* Check out the list of customers
*/
@Override
public List<User> findAll() {
Set<String> keys = usermap.keySet();
for (String str : keys) {
list.add(usermap.get(str));
}
return list;
}
/**
* Delete the specified id The customer
*/
@Override
public void delete(String id) {
if (usermap.get(id) == null) {
System.out.println(" No current id The customer ");
} else {
System.out.println(usermap.get(id) + " deleted !!!");
usermap.remove(id);
}
}
/**
* Change Password ( Current login user's )
*/
public void changepwd(String id) {
User user = findById(id);
System.out.println(" Please enter the new password :");
String str = sc.next();
User t = new User(user.getuID(), user.getUname(), user.getUsex(), str, user.getUadress(), user.getUtel(),
user.getUtime());
usermap.put(id, t);
}
/**
* adopt id Find the corresponding customer
*/
@Override
public User findById(String id) {
if (usermap.get(id) == null) {
return null;
} else {
return usermap.get(id);
}
}
}

4.Dishes Property management class

package com.softeem.lesson23.test2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
public class DishesSys implements DAO<Dishes> {
// Create a menu of map aggregate , Among them, the dishes are id by map Key , The whole dish is for map Value
static Map<String, Dishes> dishesmap = new HashMap<>();
Set<String> keys = dishesmap.keySet();
/**
* Add dishes
*/
@Override
public void insert(Dishes t) {
dishesmap.put(t.getdID(), t);
}
/**
* adopt id To find dishes
*/
@Override
public Dishes findById(String id) {
if (dishesmap.get(id) == null) {
return null;
} else {
return dishesmap.get(id);
}
}
/**
* Find dishes by dish type
*/
public List<Dishes> findByType(String type) {
List<Dishes> list = new ArrayList<>();
for (String key : keys) {
if (Objects.equals(type, dishesmap.get(key).getDtype())) {
list.add(dishesmap.get(key));
}
}
return list;
}
/**
* Check all the dishes
*/
@Override
public List<Dishes> findAll() {
List<Dishes> list = new ArrayList<>();
for (String str : keys) {
list.add(dishesmap.get(str));
}
return list;
}
public void selectBytype(String typename) {
int count = 0;
for (String key : keys) {
if (Objects.equals(dishesmap.get(key).getDtype(), typename)) {
System.out.println(dishesmap.get(key));
count++;
}
}
if (count == 0) {
System.out.println(" There are no dishes in the current category !");
}
}
/**
* Delete the specified id variety of dishes
*/
@Override
public void delete(String id) {
if (dishesmap.get(id) == null) {
System.out.println(" Input id error ...");
} else {
dishesmap.remove(id);
}
}
}

That's basically the core of the code , The rest is much simpler , Create a menu class , Just call them separately
3、 ... and 、 Menu class

package com.softeem.lesson23.test2;
import java.util.Objects;
import java.util.Scanner;
public class Menu {
static AdminSys admin = new AdminSys();
Scanner sc = new Scanner(System.in);
public void showMenu() {
admin.addMessage();
System.out.println(" Please enter your account number and password : according to ( account number / password )");
String str = sc.next();
String[] info = str.split("/");
if (info.length < 2) {
System.out.println(" Incorrect input , Please re-enter :");
showMenu();
} else {
if (admin.findById(info[0]) != null && Objects.equals(admin.findById(info[0]).getApwd(), info[1])) {
adminMenu();
} else if (admin.findUserByid(info[0]) != null
&& Objects.equals(info[1], admin.findUserByid(info[0]).getUpwd())) {
User user = admin.findUserByid(info[0]);
userMenu(user);
} else {
System.out.println(" Incorrect input , Please re-enter ....");
showMenu();
}
}
}
public void userMenu(User user) {
System.out.println("========= Welcome to the ordering system =======");
System.out.println("====【1】 Order =================");
System.out.println("====【2】 Display all dishes according to the dish category ===");
System.out.println("====【3】 View all orders ============");
System.out.println("====【4】 Change Password ===============");
System.out.println("====【5】 Personal information display ============");
System.out.println("====【6】 sign out ==================");
System.out.println(" Please input the operation you want to do :");
String n = sc.next();
switch (n) {
case "1":
admin.shopDishes(user);
userMenu(user);
break;
case "2":
admin.ShowOfTypeByUser();
userMenu(user);
break;
case "3":
admin.showAllOrderByUser(user);
userMenu(user);
break;
case "4":
admin.changePwdByUser(user);
userMenu(user);
break;
case "5":
admin.showByUser(user);
userMenu(user);
break;
case "6":
System.out.println(" Thank you for using. , bye !");
System.exit(0);
default:
System.out.println(" Input error , Please re-enter :");
userMenu(user);
}
}
public void adminMenu() {
System.out.println("========= Welcome to your distinguished administrator =======");
System.out.println("====【1】 Add dishes ===============");
System.out.println("====【2】 View all dishes information display =======");
System.out.println("====【3】 View the food information of the specified category =====");
System.out.println("====【4】 According to the dishes id Change the price of dishes =====");
System.out.println("====【5】 Delete the specified id The dishes =========");
System.out.println("====【6】 Add customers ================");
System.out.println("====【7】 Check out the list of customers =============");
System.out.println("====【8】 Delete the specified id Users of ==========");
System.out.println("====【9】 The order list shows =============");
System.out.println("====【10】 According to the order id Modify order status ====");
System.out.println("====【11】 sign out =================");
String m = sc.next();
switch (m) {
case "1":
admin.addDishes();
adminMenu();
break;
case "2":
System.out.println(" Please enter how much data you need to display per line :");
int pageSize = sc.nextInt();
admin.showAllDishes(pageSize);
adminMenu();
break;
case "3":
admin.selecBytypeOfAdmin();
adminMenu();
break;
case "4":
admin.selectByDishesID();
adminMenu();
break;
case "5":
admin.deleteDishes();
adminMenu();
break;
case "6":
admin.addUser();
adminMenu();
break;
case "7":
admin.findUser();
adminMenu();
break;
case "8":
admin.deleteUserByAdmin();
adminMenu();
break;
case "9":
admin.showAllOrder();
adminMenu();
break;
case "10":
admin.changeOrderValue();
adminMenu();
break;
case "11":
System.out.println(" Thank you for using. , bye !");
System.exit(0);
break;
default:
System.out.println(" Input error , Please re-enter :");
adminMenu();
}
}
}

here switch take String(jdk1.7 I will support it later ) Can let the user even if the input error will not report an error, resulting in the termination of the program , I want to reenter ( I have a showdown , It's laziness ).
Four 、 Test class

package com.softeem.lesson23.test2;
public class Test {
public static void main(String[] args) {
Menu m = new Menu();
m.showMenu();
}
}

5、 ... and 、 Achieve part of the interface screenshot
 Insert picture description here

 Insert picture description here

 Insert picture description here

 Insert picture description here

 Insert picture description here

 Insert picture description here

 Insert picture description here

 Insert picture description here

That's all the code .

Project recommend :

2000 many G Computer industry electronic resources sharing ( Continuous updating )

2020 Making friends with meow, the full stack project of wechat apps in 【 Courseware and source code attached 】

Spring Boot Develop a small and beautiful personal blog 【 Courseware and source code attached 】

Java Micro service practice 296 Big video - Grain Mall 【 Code and courseware attached 】

Java The development of micro service and the practice of shopping mall 【 whole 357 Jida project 】- Code and courseware attached

The most complete and detailed data structure and algorithm video -【 Courseware and source code attached 】​​​​​​​

 Insert picture description here

版权声明
本文为[Spiderman can't fly]所创,转载请带上原文链接,感谢
https://javamana.com/2021/01/20210120230524572q.html

  1. 【计算机网络 12(1),尚学堂马士兵Java视频教程
  2. 【程序猿历程,史上最全的Java面试题集锦在这里
  3. 【程序猿历程(1),Javaweb视频教程百度云
  4. Notes on MySQL 45 lectures (1-7)
  5. [computer network 12 (1), Shang Xuetang Ma soldier java video tutorial
  6. The most complete collection of Java interview questions in history is here
  7. [process of program ape (1), JavaWeb video tutorial, baidu cloud
  8. Notes on MySQL 45 lectures (1-7)
  9. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  10. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  11. 精进 Spring Boot 03:Spring Boot 的配置文件和配置管理,以及用三种方式读取配置文件
  12. Refined spring boot 03: spring boot configuration files and configuration management, and reading configuration files in three ways
  13. 【递归,Java传智播客笔记
  14. [recursion, Java intelligence podcast notes
  15. [adhere to painting for 386 days] the beginning of spring of 24 solar terms
  16. K8S系列第八篇(Service、EndPoints以及高可用kubeadm部署)
  17. K8s Series Part 8 (service, endpoints and high availability kubeadm deployment)
  18. 【重识 HTML (3),350道Java面试真题分享
  19. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  20. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  21. [re recognize HTML (3) and share 350 real Java interview questions
  22. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  23. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  24. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  25. RPC 1: how to develop RPC framework from scratch
  26. 造轮子系列之RPC 1:如何从零开始开发RPC框架
  27. RPC 1: how to develop RPC framework from scratch
  28. 一次性捋清楚吧,对乱糟糟的,Spring事务扩展机制
  29. 一文彻底弄懂如何选择抽象类还是接口,连续四年百度Java岗必问面试题
  30. Redis常用命令
  31. 一双拖鞋引发的血案,狂神说Java系列笔记
  32. 一、mysql基础安装
  33. 一位程序员的独白:尽管我一生坎坷,Java框架面试基础
  34. Clear it all at once. For the messy, spring transaction extension mechanism
  35. A thorough understanding of how to choose abstract classes or interfaces, baidu Java post must ask interview questions for four consecutive years
  36. Redis common commands
  37. A pair of slippers triggered the murder, crazy God said java series notes
  38. 1、 MySQL basic installation
  39. Monologue of a programmer: despite my ups and downs in my life, Java framework is the foundation of interview
  40. 【大厂面试】三面三问Spring循环依赖,请一定要把这篇看完(建议收藏)
  41. 一线互联网企业中,springboot入门项目
  42. 一篇文带你入门SSM框架Spring开发,帮你快速拿Offer
  43. 【面试资料】Java全集、微服务、大数据、数据结构与算法、机器学习知识最全总结,283页pdf
  44. 【leetcode刷题】24.数组中重复的数字——Java版
  45. 【leetcode刷题】23.对称二叉树——Java版
  46. 【leetcode刷题】22.二叉树的中序遍历——Java版
  47. 【leetcode刷题】21.三数之和——Java版
  48. 【leetcode刷题】20.最长回文子串——Java版
  49. 【leetcode刷题】19.回文链表——Java版
  50. 【leetcode刷题】18.反转链表——Java版
  51. 【leetcode刷题】17.相交链表——Java&python版
  52. 【leetcode刷题】16.环形链表——Java版
  53. 【leetcode刷题】15.汉明距离——Java版
  54. 【leetcode刷题】14.找到所有数组中消失的数字——Java版
  55. 【leetcode刷题】13.比特位计数——Java版
  56. oracle控制用户权限命令
  57. 三年Java开发,继阿里,鲁班二期Java架构师
  58. Oracle必须要启动的服务
  59. 万字长文!深入剖析HashMap,Java基础笔试题大全带答案
  60. 一问Kafka就心慌?我却凭着这份,图灵学院vip课程百度云