It is mainly to increase the number of people in provinces, reduce re inspection and increase re inspection , Administrator registration login .
It draws lessons from some materials and is relatively simple , Not many functions , Add a main function to run .

(2021/5/14 Later transformed into SpirngBoot,SpringCloud,SpirngSecurity,Mybatis project
Relatively large synchronization in github Yes Not here Release only demo bar )
package yiqing; public class Province { private String ProvinceName; @Override
public int hashCode() { final int prime = 31; int result = 1; result = prime *
result+ ((ProvinceName == null) ? 0 : ProvinceName.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;
Province other = (Province) obj; if (ProvinceName == null) { if (other.
ProvinceName != null) return false; } else if (!ProvinceName.equals(other.
ProvinceName)) return false; return true; } public String getProvinceName() {
return ProvinceName; } public void setProvinceName(String provinceName) {
ProvinceName = provinceName; } public Province(String provinceName) {
ProvinceName = provinceName; } public Province() {} } package yiqing; public
class MenuUtils { public static void Welcome() { System.out.println(
"==== Please log in to the epidemic control terminal ===="); System.out.println("1. Sign in "); System.out.println("2. register ");
System.out.println("3. sign out "); } public static void control() { System.out.println(
"==== Welcome to the epidemic control terminal ===="); System.out.println("1. View the number of epidemic cases in China "); System.out.println(
"2. Reduce the number of epidemic cases in designated areas "); System.out.println("3. Designated cured patients relapse , Re increase "); System.out.println(
"4. View the number of people who have recovered in the specified provinces and cities "); System.out.println("5. Increase the number of epidemic cases in designated areas "); System.out.println(
"6. Return to the previous level "); } } package yiqing; import java.awt.print.Book; import java.util.
HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.
Scanner; import java.util.Set; public class ProvinceManager { private Map<
Province,Integer> provinces = new HashMap<>(); { provinces.put(new Province(" Beijing "
), 0); provinces.put(new Province(" Tianjin "), 0); provinces.put(new Province(" Hebei "), 0
); provinces.put(new Province(" Shanxi "), 0); provinces.put(new Province(" Inner Mongolia "), 0);
provinces.put(new Province(" Ningxia "), 0); provinces.put(new Province(" Qinghai "), 0);
provinces.put(new Province(" Shaanxi "), 0); provinces.put(new Province(" Gansu "), 0);
provinces.put(new Province(" Xinjiang "), 0); provinces.put(new Province(" Liaoning "), 0);
provinces.put(new Province(" Jilin "), 0); provinces.put(new Province(" Heilongjiang "), 0);
provinces.put(new Province(" Shandong "), 0); provinces.put(new Province(" Jiangsu "), 0);
provinces.put(new Province(" Shanghai "), 0); provinces.put(new Province(" Zhejiang "), 0);
provinces.put(new Province(" Anhui "), 0); provinces.put(new Province(" Fujian "), 0);
provinces.put(new Province(" Jiangxi "), 0); provinces.put(new Province(" Henan "), 0);
provinces.put(new Province(" Hunan "), 0); provinces.put(new Province(" Hubei "), 0);
provinces.put(new Province(" Sichuan "), 0); provinces.put(new Province(" Guizhou "), 0);
provinces.put(new Province(" Yunnan "), 0); provinces.put(new Province(" Chongqing "), 0);
provinces.put(new Province(" Tibet "), 0); provinces.put(new Province(" Guangdong "), 0);
provinces.put(new Province(" Guangxi "), 0); provinces.put(new Province(" Hainan "), 0);
provinces.put(new Province(" Hong Kong "), 0); provinces.put(new Province(" Macao "), 0);
provinces.put(new Province(" Taiwan "), 0); } private ProvinceManager() {} private
static ProvinceManager instance = new ProvinceManager(); public static
ProvinceManager getInstance() { if(instance == null) { instance = new
ProvinceManager(); } return instance; } Scanner sc = new Scanner(System.in);
public void start(User u) { while(true) { MenuUtils.control(); System.out.
println(" Please select "); int choose = sc.nextInt(); switch(choose) { case 1: {
showProvinces(); break; } case 2: { HashMap<Province,Integer> map =
ReduceProvince(); if(map!=null) { u.saveProvince(map); }else { System.out.
println(" Failed to reduce the number of people "); } break; } case 3: { Map<Province,Integer> uMap = u.
returnProvince(); if(uMap!=null) { returnProvinceManager(uMap); }else { System.
out.println(" Failed to add recurrence number "); } break; } case 4: { u.showProvince(); break; } case 5:
{ HashMap<Province,Integer> map = addProvinces(); System.out.println(
" Please enter the name of the province to increase the number of people and the number to increase "); if(map!=null) { u.saveProvince(map); }else { System.out.
println(" Failed to increase the number of people "); } break; } case 6: { return; } } } } private void
showProvinces() { Set<Entry<Province,Integer>> entrySet = provinces.entrySet();
System.out.println(" province \t quantity "); for(Entry<Province,Integer> entry:entrySet) {
System.out.println(entry.getKey().getProvinceName()+"\t"+entry.getValue()); } }
private HashMap<Province,Integer> ReduceProvince(){ while(true) { System.out.
println(" Please enter the province name "); String pname = sc.next(); Province province = new Province(
pname); boolean containsKey = provinces.containsKey(province); if(!containsKey)
{ System.out.println(" Without this province "); continue; } System.out.println(" Please enter the quantity you want to reduce "); int
num= sc.nextInt(); Integer count = provinces.get(province); if(num>count) {
System.out.println(" Not so many people "); return null; } provinces.put(province, count-num);
HashMap<Province,Integer> map = new HashMap<>(); map.put(province, num); return
map; } } private void returnProvinceManager(Map<Province,Integer> uMap) { Set<
Entry<Province,Integer>> entrySet = uMap.entrySet(); for(Entry<Province,Integer>
entry:entrySet) { Integer count = entry.getValue(); Province province = entry.
getKey(); Integer num = provinces.get(province); provinces.put(province, num==
null?count:count+num); } System.out.println(" Recurrence patient added successfully "); } private HashMap<
Province,Integer> addProvinces(){ System.out.println(" Please enter the province name "); String pname =
sc.next(); Province province = new Province(pname); boolean ContainsKey =
provinces.containsKey(province); if(!ContainsKey) { System.out.println(" Without this province ");
} System.out.println(" Enter the number of people you want to add "); int num = sc.nextInt(); Integer count =
provinces.get(province); provinces.put(province, num+count); return (HashMap<
Province, Integer>) provinces; } } package yiqing; import java.util.HashMap;
import java.util.Map; import java.util.Map.Entry; import java.util.Scanner;
import java.util.Set; public class User { @Override public int hashCode() {
final int prime = 31; int result = 1; result = prime * result + ((UserName ==
null) ? 0 : UserName.hashCode()); result = prime * result + ((UserPassword ==
null) ? 0 : UserPassword.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; User other = (User) obj; if (
UserName == null) { if (other.UserName != null) return false; } else if (!
UserName.equals(other.UserName)) return false; if (UserPassword == null) { if (
other.UserPassword != null) return false; } else if (!UserPassword.equals(other.
UserPassword)) return false; return true; } public String getUserName() { return
UserName; } public void setUserName(String userName) { UserName = userName; }
public String getUserPassword() { return UserPassword; } public void
setUserPassword(String userPassword) { UserPassword = userPassword; } private
String UserName; private String UserPassword; public User(String userName,
String userPassword) { super(); UserName = userName; UserPassword = userPassword
; } public User() {} /* * Table storing the number of epidemic cases */ private HashMap<Province,Integer> hashmap
= new HashMap<>(); public void saveProvince(HashMap<Province,Integer> map) { Set
<Entry<Province,Integer>> entrySet = map.entrySet(); for(Entry<Province,Integer>
entry:entrySet) { Province province = entry.getKey(); Integer count = entry.
getValue(); Integer num = hashmap.get(province); hashmap.put(province, num==null
? count:num+count); } System.out.println(" success !"); } public Map<Province,Integer>
returnProvince(){ while(true) { Scanner sc = new Scanner(System.in); System.out.
println(" Please enter the name of the province where you want to increase the number of people "); String pname = sc.next(); Province province = new
Province(pname); boolean containsKey = hashmap.containsKey(province); if(!
containsKey) { System.out.println(" There is no such province Please re-enter "); continue; } System.out.
println(" Please enter the number of recurrences "); int num = sc.nextInt(); Integer count = hashmap.get(
province); if(num>count) { System.out.println(" Not so many people "); return null; } hashmap.
put(province, count-num); Map<Province,Integer> map = new HashMap<>(); map.put(
province, num); return map; } } public void showProvince() { Set<Entry<Province,
Integer>> entryset = hashmap.entrySet(); System.out.println(" province \t quantity "); for(Entry
<Province,Integer> entry:entryset) { System.out.println(entry.getKey().
getProvinceName()+"\t"+entry.getValue()); } } } package yiqing; import java.util
.HashSet; import java.util.Scanner; import java.util.Set; public class
UserManager { private Set<User> users = new HashSet<>(); public UserManager() {
users.add(new User("admin","root")); } /* * opening menu */ public void start() { while(
true) { MenuUtils.Welcome(); System.out.println(" Please enter your choice "); Scanner sc = new
Scanner(System.in); int choose = sc.nextInt(); switch(choose) { case 1: { User
luser= login(); User lUser = new User(); if(lUser != null) { ProvinceManager.
getInstance().start(lUser); }else { System.out.println(" Login failed "); } break; } case
2: { boolean reg = register(); System.out.println(reg?" login was successful ":" login has failed "); break; }
case 3: { System.out.println(" Exit program "); System.exit(0); break; } default: { break;
} } } } Scanner sc = new Scanner(System.in); private User login() { System.out.
println(" Please enter your user name ,exsit sign out "); String username = sc.next(); if(username.equals(
"exsit")) { start(); } boolean checkusername = checkUsername(username); if(!
checkusername) { System.out.println(" user name does not exist , Please re-enter "); return login(); } System.
out.println(" Please enter your password "); String password = sc.next(); for(User user :users) { if(
user.getUserName().equals(username)&&user.getUserPassword().equals(password)) {
return user; }else { System.out.println(" Password input error , Please re-enter "); return login(); } }
return null; } private boolean checkUsername(String username) { for(User user:
users) { if(user.getUserName().equals(username)) { return true; } } return false
; } private boolean register() { while(true) { System.out.println(" Please enter the user name you want to register "
); String username = sc.next(); if(username.equals("exsit")) { return false; }
boolean isCheck = checkUsername(username); if(isCheck) { System.out.println(
" User name already exists , Please re-enter "); continue; } System.out.println(" Please enter the password you want to register "); String password
= sc.next(); return users.add(new User(username,password)); } } }

Technology
©2019-2020 Toolsou All rights reserved,
Android Using wechat in H5 Payment result refresh during payment shock !!C++ Can make a sound ! Basic operation of single linked list C Language explanation Java Implement an epidemic number management system 2021 year 11 World programming language ranking linux upper mysql Invalid command _linux lower mysql The command is useless Java project : Campus dormitory management system (java+jsp+javaweb+mysql+ajax) Wechat applet development project directory linux ubuntu Which version ,Ubuntu Which version is the best ?python Code painting cherry blossoms - How to use Python Draw a beautiful cherry blossom