java实现双色球彩票系统

public class SSQ {
    public static void main(String[] args) {

        int lan = (int) ((16) * Math.random() + 1);
        int hon[] = new int[6];
        for (int i = 0; i < hon.length; i++) {
            hon[i] = (int) ((33) * Math.random() + 1);
            for (int j = 0; j < i; j++) {
                if (hon[i] == hon[j]) {
                    i--;
                    break;
                }
            }
        }
        Scanner s = new Scanner(System.in);
        int a[] = new int[6];
        int blue = 0;
       do {
            System.out.println("*******************欢迎光临双色球彩票系统    票价 2 元**********************");
            do {
                System.out.println(">>请输入双色球号码");
                System.out.println("请输入蓝色球号码(16选1)");
                blue = s.nextInt();//16
                System.out.println("请输入红色球号码(33选6,无重复)");
                for (int i = 0; i < a.length; i++) {
                    a[i] = s.nextInt();
                }
                System.out.println("是否确定?y/n");
            } while (s.next().equals("n"));
            System.out.println("---------------顾客:您选择的号码如下------------------");
            System.out.println("蓝色球为:" + blue);
            System.out.println("红色球为:" + Arrays.toString(a));
            boolean l = false;
            if (lan == blue) {
                l = true;
            }
            int count = 0;
            for (int i = 0; i < a.length; i++) {
                for (int j = 0; j < hon.length; j++) {
                     if (a[i] == hon[j]) {
                        count++;
                    }
                }
            }
            if (l && count == 6) {
                System.out.println("恭喜你中了500W");
            } else if (!l && count == 6) {
                System.out.println("恭喜你中了20W");
            } else if (!l && count == 5 || l && count == 4) {
                System.out.println("恭喜你中了3000");
            } else if (!l && count == 4 || l && count == 3) {
                System.out.println("恭喜你中了10块");
            } else if (!l && count == 2 || l && count == 1 || l && count == 0) {
                System.out.println("恭喜你中了5块");
            } else {
                System.out.println("其实你中了五百万");
            }
            System.out.println("---------------本注双色球号码为--------------------------");
            System.out.println("蓝色球为:" + lan);
            System.out.println("红色球为:" + Arrays.toString(hon));
            System.out.println("感谢你的参与,祝你下次中奖");
           System.out.println("是否继续?y/n");
        }while (s.next().equals("y"));
    }

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值