彩票系统 35选7
来源:互联网 发布:北方医疗大数据 编辑:程序博客网 时间:2024/04/30 11:30
代码如下:
public class Main { public static void main(String[] args) { // write your code here Main main = new Main(); int[] yStr = new int[7]; String regexID = "\\d{15}(\\d\\d[0-9xX])?"; Scanner scanner = new Scanner(System.in); System.out.println("1、彩票系统35选7"); System.out.println("———————————— 购买彩票 ————————————"); System.out.println("身份证号:"); String iD = scanner.next(); if (!iD.matches(regexID)) { System.out.println("请正确输入身份证号码"); main(args); } System.out.println("购买号码:(输入(1-35)的7个数字,以逗号间隔)"); for (int i = 0; i < 7; i++) { yStr[i] = scanner.nextInt(); } main.isEquals(yStr); } /** * 比较彩票 * * @param yStr */ private void isEquals(int[] yStr) { int[] sStr = new int[7]; int count = 0; StringBuffer stringBuffer = new StringBuffer(); for (int s = 0; s < 7; s++) { sStr[s] = (int) (Math.random() * 35 + 1); stringBuffer.append(sStr[s] + "-"); } for (int i = 0; i < 7; i++) for (int j = 0; j < 7; j++) { if (sStr[i] == yStr[j]) { count++; } } System.out.println("———————————— 彩票开奖 ————————————"); System.out.println("[" + stringBuffer.substring(0, stringBuffer.length() - 1).toString() + "]"); switch (count) { case 1: System.out.println("———————————— 兑奖信息 ————————————"); System.out.println("中奖个数:" + count); System.out.println("中奖金额:5元"); break; case 2: System.out.println("———————————— 兑奖信息 ————————————"); System.out.println("中奖个数:" + count); System.out.println("中奖金额:10元"); break; case 3: System.out.println("———————————— 兑奖信息 ————————————"); System.out.println("中奖个数:" + count); System.out.println("中奖金额:20元"); break; case 4: System.out.println("———————————— 兑奖信息 ————————————"); System.out.println("中奖个数:" + count); System.out.println("中奖金额:50元"); break; case 5: System.out.println("———————————— 兑奖信息 ————————————"); System.out.println("中奖个数:" + count); System.out.println("中奖金额:100元"); break; case 6: System.out.println("———————————— 兑奖信息 ————————————"); System.out.println("中奖个数:" + count); System.out.println("中奖金额:200元"); break; case 7: System.out.println("———————————— 兑奖信息 ————————————"); System.out.println("中奖个数:" + count); System.out.println("中奖金额:500万元"); break; case 0: System.out.println("———————————— 兑奖信息 ————————————"); System.out.println("中奖个数:0"); System.out.println("中奖金额:谢谢您捐赠的2元钱!"); break; } }}
0 0
- 彩票系统 35选7
- 简单的35选7彩票系统
- 彩票35选7
- 彩票35选7
- Java简单彩票系统(35选7)
- 35选7彩票自选系统(附加实现效果Java源代码)
- java-彩票生成器(35选7)
- 彩票36选7
- 每日一算法7--35选7彩票程序
- 选彩票
- 双色球彩票管理系统
- 彩票系统架构研究
- java 彩票系统
- java彩票系统
- 36 选 7 彩票机选程序
- 写一个彩票程序:30选7
- 汇编编写彩票36选7摇奖
- JavaCodeTra 36选7 彩票抽奖
- 给我半个小时记录一下最近
- 数据结构 前言
- C++基础---面向对象建模方法
- 2015.9.13
- 操作系统内核Hack:(一)实验环境搭建
- 彩票系统 35选7
- SQlite的数据库查询
- Android sendevent/getevent 用法
- 话说Mac终端下 遇到的千奇百怪的报错及解决方法
- 分布式缓存GemFire架构介绍
- poj 3318 随机(矩阵相乘判断)
- Gradle User Guide(1)
- 安装mysql
- 多巴胺对于情绪的影响 理智与感性