IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> Java知识库 -> 用java写一个抽卡游戏!来体验下黑心老板的感觉! -> 正文阅读

[Java知识库]用java写一个抽卡游戏!来体验下黑心老板的感觉!

用java写一个抽卡游戏!来体验下黑心老板的感觉!

今天呢我在b站逛的时候,看到了一个视频吸引了我的注意力(这里放出视频链接)

游戏氪金玩家必看!教你怎么躲避大数据算法杀熟,助你抽卡SSR、爆落神装、宝箱大赚

我就心血来潮,决定自己也写一个简易版的抽卡游戏,现在就给大家展示一下!
ps:其实不算游戏qwq,就只能算是"集五福"的那种.

卡:
有六张卡

目标:集齐所有的卡!

变量:
1.name
2.总充值
3.现有余额
4.最后上线时间(这个在我懒得做他的分析了)
5.总在线时间
6.背包

这里用到sql数据库
在这里插入图片描述
注意:package中用"1"表示"0",因为在sql中011101会被记为11101当然也有其他解决问题的方法,这里就不细说了。

主程序:
1.SQL连接

public class Amain {
	/*
	 *@author Saturn
	 */
	public static final String USER = "root";
    public static final String PASS = "1234";
    
    public static void main(String args[]) throws Exception{
    try {
        Class.forName("com.mysql.cj.jdbc.Driver");//数据库驱动
    } catch (Exception e) {
    	e.printStackTrace();
    }
	Connection conn;
	var name = "1"; //这里是后面要用到的动态变量
	var money = 0;
	var moneyin = 0;
	var lastonline = "";
	var totalonline = 0;
	var pack = 0;
	try {
		conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/user?useSSL=false", USER, PASS);
		Statement state = conn.createStatement();
	} catch (Exception e) {
		System.err.println("发生错误");
		e.printStackTrace();
	}
}
	

程序要读取你的数据,所以增加

ResultSet rs = state.executeQuery(s);
        while (rs.next()) {
        	String a1 = rs.getString(1);
        	if (a1.equals(name)) {
        		money = rs.getInt(2);
        		moneyin = rs.getInt(3);
        		Date lastonline1 = rs.getDate(4);
        		lastonline = "" + lastonline1;
        		totalonline = rs.getInt(5);
        		pack  = rs.getInt(6);
        		
        		}
        }
        System.out.println(name + "," + money + "," + moneyin + "," + lastonline + "," + totalonline + "," + pack);
        String main1 = "" + pack;
        String result[] = main1.split("");
        System.out.println("+--------------+");
        System.out.println("您的一号卷有" + (Integer.parseInt(result[0]) - 1) + "张.");
        System.out.println("您的二号卷有" + (Integer.parseInt(result[1]) - 1) + "张.");
        System.out.println("您的三号卷有" + (Integer.parseInt(result[2]) - 1) + "张.");
        System.out.println("您的四号卷有" + (Integer.parseInt(result[3]) - 1) + "张.");
        System.out.println("您的五号卷有" + (Integer.parseInt(result[4]) - 1) + "张.");
        System.out.println("您的六号卷有" + (Integer.parseInt(result[5]) - 1) + "张.");
        System.out.println("+--------------+");

之后呢,再加个循环判断输入语句

while(true) {
        	String moneyinup = "UPDATE `user`.`new` SET `moneyin` = '" + moneyin + "' WHERE `name` = '" + name + "'";
        	//这里是为了及时更新数据到数据库以免出Bug
    		state.executeUpdate(moneyinup);
    		String moneyup = "UPDATE `user`.`new` SET `money` = '" + money + "' WHERE `name` = '" + name + "'";
    		state.executeUpdate(moneyup);
            ResultSet rs1 = state.executeQuery(s);
        	 while (rs1.next()) {
 	        	String a1 = rs1.getString(1);
 	        	if (a1.equals(name)) {
 	        		money = rs1.getInt(2);
 	        		moneyin = rs1.getInt(3);
 	        		Date lastonline1 = rs1.getDate(4);
 	        		lastonline = "" + lastonline1;
 	        		totalonline = rs1.getInt(5);
 	        		pack  = rs1.getInt(6);
 	        		
 	        	}
        	 }
        	System.out.println("输入:");
        	Scanner scan = new Scanner(System.in);
    		if (scan.hasNext()) {
    			String a = scan.next();
    			//这里加判断语句
    		}
   }

ok,框架已经完成了!这时候我们就来解决卡池的问题吧!

这里建了A,B,C三个池子,与你所料,A池子的爆率最高出现重复的概率也越少。
A池:

class A {	//A类池
	private int pack;
	public A(int pack) {
		this.pack = pack;
	}
	public String run() {
		var a1 = "" + this.pack;
		String result[] = a1.split("");
		int number0 = 0;
		for (int x = 0; x <result.length; x ++) {
			if(result[x].equals("1")) {
				number0 ++;
			}
		}
		if (number0 <= 2 && number0 > 0) {
			Random rand = new Random();
	        int a2 = (rand.nextInt(100));
	        if (a2 > 5 && a2 < 9) {
	        	int a3 = 0;
	        	while(true) {
	        		if(result[a3].equals("1")) {
	        			var num = Integer.parseInt(a1);
	        			num = (int) (num + Math.pow(10,(5 - a3)));
	        			a1 = "" + num; 
	        			return "恭喜中奖! " + a1;
	        		} else {
	        			a3 ++;
	        		}
	        	}
	        } else if (a2 > 10 && a2 < 40) {
	        	int a3 = (rand.nextInt(5));
	        	var num = Integer.parseInt(a1);
	        	num = (int) (num + Math.pow(10,(5 - a3)));
	        	a1 = "" + num; 
	        	return "恭喜中奖! " + a1;
	        	
	        } 
	        else {
	        	return "您没有中奖! " + a1;
	        }
		} else if (number0 <= 4 && number0 > 2) {
			Random rand = new Random();
	        int a2 = (rand.nextInt(100));
	        if (a2 > 5 && a2 < 30) {
	        	int a3 = 0;
	        	while(true) {
	        		if(result[a3].equals("1")) {
	        			var num = Integer.parseInt(a1);
	        			num = (int) (num + Math.pow(10,(5 - a3)));
	        			a1 = "" + num; 
	        			return "恭喜中奖! " + a1;
	        		} else {
	        			a3 ++;
	        		}
	        	}
	        } else if (a2 > 30 && a2 < 60) {
	        	int a3 = (rand.nextInt(5));
	        	var num = Integer.parseInt(a1);
	        	num = (int) (num + Math.pow(10,(5 - a3)));
	        	a1 = "" + num; 
	        	return "恭喜中奖! " + a1;
	        }
	        else {
	        	return "您没有中奖! " + a1;
	        }
		} else if (number0 <= 6 && number0 > 4) {
			Random rand = new Random();
	        int a2 = (rand.nextInt(100));
	        if (a2 > 5 && a2 < 70) {
	        	int a3 = (rand.nextInt(5));
	        	var num = Integer.parseInt(a1);
	        	num = (int) (num + Math.pow(10,(5 - a3)));
	        	a1 = "" + num; 
	        	return "恭喜中奖! " + a1;
	        } else {
	        	return "您没有中奖! " + a1;
	        }
		} else if (number0 == 0) {
			Random rand = new Random();
	        int a2 = (rand.nextInt(100));
	        if (a2 > 5 && a2 < 50) {
		        int a3 = (rand.nextInt(4));
	        	var num = Integer.parseInt(a1);
	        	num = (int) (num + Math.pow(10,(5 - a3)));
	        	a1 = "" + num; 
	        	return "恭喜中奖! " + a1;
	        } else {
	        	return "您没有中奖! " + a1;
	        }
		}
		else {
			return "您没有中奖! " + a1;
		}
	}
}

B和C池:

class B {
	private int pack;
	public B(int pack) {
		this.pack = pack;
	}
	public String run() {
		var a1 = "" + this.pack;
		String result[] = a1.split("");
		int number0 = 0;
		for (int x = 0; x <result.length; x ++) {
			if(result[x].equals("1")) {
				number0 ++;
			}
		}
		if (number0 <= 2 && number0 > 0) {
			Random rand = new Random();
	        int a2 = (rand.nextInt(200));
	        if (a2 > 5 && a2 < 8) {
	        	int a3 = 0;
	        	while(true) {
	        		if(result[a3].equals("1")) {
	        			var num = Integer.parseInt(a1);
	        			num = (int) (num + Math.pow(10,(5 - a3)));
	        			a1 = "" + num; 
	        			return "恭喜中奖! " + a1;
	        		} else {
	        			a3 ++;
	        		}
	        	}
	        } else if (a2 > 10 && a2 < 30) {
	        	int a3 = (rand.nextInt(5));
	        	var num = Integer.parseInt(a1);
	        	num = (int) (num + Math.pow(10,(5 - a3)));
	        	a1 = "" + num; 
	        	return "恭喜中奖! " + a1;
	        	
	        } 
	        else {
	        	return "您没有中奖! " + a1;
	        }
		} else if (number0 <= 4 && number0 > 2) {
			Random rand = new Random();
	        int a2 = (rand.nextInt(100));
	        if (a2 > 5 && a2 < 25) {
	        	int a3 = 0;
	        	while(true) {
	        		if(result[a3].equals("1")) {
	        			var num = Integer.parseInt(a1);
	        			num = (int) (num + Math.pow(10,(5 - a3)));
	        			a1 = "" + num; 
	        			return "恭喜中奖! " + a1;
	        		} else {
	        			a3 ++;
	        		}
	        	}
	        } else if (a2 > 30 && a2 < 45) {
	        	int a3 = (rand.nextInt(5));
	        	var num = Integer.parseInt(a1);
	        	num = (int) (num + Math.pow(10,(5 - a3)));
	        	a1 = "" + num; 
	        	return "恭喜中奖! " + a1;
	        }
	        else {
	        	return "您没有中奖! " + a1;
	        }
		} else if (number0 <= 6 && number0 > 4) {
			Random rand = new Random();
	        int a2 = (rand.nextInt(100));
	        if (a2 > 5 && a2 < 60) {
	        	int a3 = (rand.nextInt(5));
	        	var num = Integer.parseInt(a1);
	        	num = (int) (num + Math.pow(10,(5 - a3)));
	        	a1 = "" + num; 
	        	return "恭喜中奖! " + a1;
	        } else {
	        	return "您没有中奖! " + a1;
	        }
		} else if (number0 == 0) {
			Random rand = new Random();
	        int a2 = (rand.nextInt(100));
	        if (a2 > 5 && a2 < 50) {
		        int a3 = (rand.nextInt(4));
	        	var num = Integer.parseInt(a1);
	        	num = (int) (num + Math.pow(10,(5 - a3)));
	        	a1 = "" + num; 
	        	return "恭喜中奖! " + a1;
	        } else {
	        	return "您没有中奖! " + a1;
	        }
		}
		else {
			return "您没有中奖! " + a1;
		}
	}
}



class C {
	private int pack;
	public C(int pack) {
		this.pack = pack;
	}
	public String run() {
		var a1 = "" + this.pack;
		String result[] = a1.split("");
		int number0 = 0;
		for (int x = 0; x <result.length; x ++) {
			if(result[x].equals("1")) {
				number0 ++;
			}
		}
		if (number0 <= 2 && number0 > 0) {
			Random rand = new Random();
	        int a2 = (rand.nextInt(300));
	        if (a2 > 5 && a2 < 7) {
	        	int a3 = 0;
	        	while(true) {
	        		if(result[a3].equals("1")) {
	        			var num = Integer.parseInt(a1);
	        			num = (int) (num + Math.pow(10,(5 - a3)));
	        			a1 = "" + num; 
	        			return "恭喜中奖! " + a1;
	        		} else {
	        			a3 ++;
	        		}
	        	}
	        } else if (a2 > 10 && a2 < 55) {
	        	int a3 = (rand.nextInt(5));
	        	var num = Integer.parseInt(a1);
	        	num = (int) (num + Math.pow(10,(5 - a3)));
	        	a1 = "" + num; 
	        	return "恭喜中奖! " + a1;
	        	
	        } 
	        else {
	        	return "您没有中奖! " + a1;
	        }
		} else if (number0 <= 4 && number0 > 2) {
			Random rand = new Random();
	        int a2 = (rand.nextInt(100));
	        if (a2 > 5 && a2 < 20) {
	        	int a3 = 0;
	        	while(true) {
	        		if(result[a3].equals("1")) {
	        			var num = Integer.parseInt(a1);
	        			num = (int) (num + Math.pow(10,(5 - a3)));
	        			a1 = "" + num; 
	        			return "恭喜中奖! " + a1;
	        		} else {
	        			a3 ++;
	        		}
	        	}
	        } else if (a2 > 30 && a2 < 40) {
	        	int a3 = (rand.nextInt(5));
	        	var num = Integer.parseInt(a1);
	        	num = (int) (num + Math.pow(10,(5 - a3)));
	        	a1 = "" + num; 
	        	return "恭喜中奖! " + a1;
	        }
	        else {
	        	return "您没有中奖! " + a1;
	        }
		} else if (number0 <= 6 && number0 > 4) {
			Random rand = new Random();
	        int a2 = (rand.nextInt(100));
	        if (a2 > 5 && a2 < 50) {
	        	int a3 = (rand.nextInt(5));
	        	var num = Integer.parseInt(a1);
	        	num = (int) (num + Math.pow(10,(5 - a3)));
	        	a1 = "" + num; 
	        	return "恭喜中奖! " + a1;
	        } else {
	        	return "您没有中奖! " + a1;
	        }
		} else if (number0 == 0) {
			Random rand = new Random();
	        int a2 = (rand.nextInt(100));
	        if (a2 > 5 && a2 < 50) {
		        int a3 = (rand.nextInt(4));
	        	var num = Integer.parseInt(a1);
	        	num = (int) (num + Math.pow(10,(5 - a3)));
	        	a1 = "" + num; 
	        	return "恭喜中奖! " + a1;
	        } else {
	        	return "您没有中奖! " + a1;
	        }
		}
		else {
			return "您没有中奖! " + a1;
		}
	}
}

之后呢,我们再加个判断数据来安排池子的if程序(此处代码较多)

if (a.equals("抽奖")) {
    				if (moneyin >= 10) {
    					moneyin = moneyin - 10;
        				System.out.println("已扣除10¥!\n目前剩余:" + moneyin + "¥");
        				if(money == 0) {
        					if (totalonline > 10 && totalonline <= 30) {
        						A abc = new A(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					} else if (totalonline >= 0 && totalonline <= 10) {
        						B abc = new B(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					} else {
        						C abc = new C(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					}
        					
        				} else if (money < 50 && money > 0) {
        					if (moneyin == 0) {
        						B abc = new B(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					} else if (moneyin > 0 && moneyin < 50) {
        						C abc = new C(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					}
        				} else if (money < 200 && money >= 50) {
        					if (moneyin == 0) {
        						B abc = new B(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					} else if (moneyin > 0 && moneyin <= 50) {
        						C abc = new C(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					} else if (moneyin > 50 && moneyin <= 70) {
        						A abc = new A(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					} else if (moneyin > 70 && moneyin <= 200) {
        						C abc = new C(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					} else {
        						B abc = new B(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					}
        				} else if (money < 500 && money >= 200) {
        					if (moneyin > 50 && moneyin <= 70) {
        						A abc = new A(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					} else if (moneyin > 300 && moneyin <= 400) {
        						C abc = new C(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					} else {
        						B abc = new B(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					}
        				} else if (money > 500) {
        					if (moneyin > 500 && moneyin <= 700) {
        						A abc = new A(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					} else if (moneyin > 900 && moneyin <= 2000) {
        						C abc = new C(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					} else {
        						B abc = new B(pack);
        						String str1 = abc.run();
        	    				String result1[] = str1.split(" ");
        	    				System.out.println(result1[0]);
        	    				String if0 = result1[0];
        	    				if (if0.equals("恭喜中奖!")) {
        	    					System.out.println("恭喜中奖!");
        	    					String sql = "UPDATE `user`.`new` SET `package` = '" + result1[1] + "' WHERE `name` = '" + name + "'";
        	        	    		state.executeUpdate(sql);
        	    				}
        					}
        				}
    				} else {
    					System.out.println("您的余额不足!");
    				}
    			
    			}

ok了,主要功能已经完成了!再加些辅助功能就完美了!

				else if (a.equals("查询")) {//这里接着上面的部分
    				String pack2 = "" + pack;
    				String result2[] = pack2.split("");
    		        System.out.println("+--------------+");
    		        System.out.println("您的一号卷有" + (Integer.parseInt(result2[0]) - 1) + "张.");
    		        System.out.println("您的二号卷有" + (Integer.parseInt(result2[1]) - 1) + "张.");
    		        System.out.println("您的三号卷有" + (Integer.parseInt(result2[2]) - 1) + "张.");
    		        System.out.println("您的四号卷有" + (Integer.parseInt(result2[3]) - 1) + "张.");
    		        System.out.println("您的五号卷有" + (Integer.parseInt(result2[4]) - 1) + "张.");
    		        System.out.println("您的六号卷有" + (Integer.parseInt(result2[5]) - 1) + "张.");
    		        System.out.println("+--------------+");
    		        System.out.println("您的余额:" + moneyin);
    			} else if (a.equals("退出")) {
    		        System.out.println("正在为您退出中...");
    		        conn.close();
    		        rs.close();
    		        state.close();
    		        System.exit(1);
    			} else if (a.equals("数据清空")) {
    				String sql = "UPDATE `user`.`new` SET `package` = '111111' WHERE `name` = '" + name + "'";
    	    		state.executeUpdate(sql);
    		        System.out.println("完成!");
    			} else if (a.contains("充值")) {
    				String result3[] = a.split("_");
    				System.out.println(result3[1]);
    				int b1 = moneyin;
    				int num = Integer.parseInt(result3[1]);
    				moneyin = moneyin + num;
    				money = money + num;
    				System.out.println("充值完成!");
    				System.out.println("您之前的余额:" + b1 + "¥");
    				System.out.println("您现在所拥有的财产:" + moneyin + "¥");
    				System.out.println("您充值:" + a + "¥!");
    			}
    			else {
    				System.out.println("未知指令!");
    			}

最后呢再放上一直我自己抽的图:
在这里插入图片描述
你们的运气都怎么样呢qwq,快来试试吧!
下载地址点我:良 心 抽 奖
在这里插入图片描述

  Java知识库 最新文章
计算距离春节还有多长时间
系统开发系列 之WebService(spring框架+ma
springBoot+Cache(自定义有效时间配置)
SpringBoot整合mybatis实现增删改查、分页查
spring教程
SpringBoot+Vue实现美食交流网站的设计与实
虚拟机内存结构以及虚拟机中销毁和新建对象
SpringMVC---原理
小李同学: Java如何按多个字段分组
打印票据--java
上一篇文章      下一篇文章      查看所有文章
加:2021-08-28 08:53:50  更:2021-08-28 08:54:26 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/23 13:15:08-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码