import java.util.Scanner;public class SsqGame {public static void main(String[] args) {int totalMoney = 0; //下注总费用 int price = 2; //双色球单价每注2元 int count=0;//购买了彩票的注数boolean isBuy = false; //标识是否购买了彩票int num[]=null;//存储双色球号Scanner input = new Scanner(System.in);do{System.out.println("");System.out.println("*****欢迎进入双色球彩票系统*****");System.out.println("\t1.购买彩票");System.out.println("\t2.查看开奖");System.out.println("\t3.退出");System.out.println("***************************");System.out.print("请选择菜单:");int choice = input.nextInt();switch (choice) {case 1://购买彩票System.out.println("[双色球彩票系统 > 购买彩票]");System.out.println("您需要下多少注?:");count = input.nextInt();//买了多少注totalMoney=count*price;//总下注钱数//开始选号(6个红色球号和1个蓝色球号)num=new int[7];//用来存储双色球号--》6红+1蓝for(int i=0;i查看开奖]");if (isBuy) { //判断是否购买了彩票//isBuy = false;//调用getLuckNum方法得到一个随机中奖号 int luckNum[]=getLuckNum();//输出你已买的彩票号System.out.print("已买的彩票号为:");for(int n:num){System.out.print(n+"\t");}System.out.println();//换行//输出当期的中奖号System.out.print("当期的中奖号为:");for(int n:luckNum){System.out.print(n+"\t");}System.out.println();//换行//判断获奖等级int result=getCompareResult(num,luckNum); //根据获奖等级输出结果 if(result==1){System.out.println("【一等奖】,恭喜你!!共下了【"+count+"】注,投资【"+totalMoney+"】元,获奖【"+(500*count)+"】万元");}else if(result==2){System.out.println("【二等奖】,恭喜你!!共下了【"+count+"】注,投资【"+totalMoney+"】元,获奖【"+(400*count)+"】万元");}else if(result==3){System.out.println("【三等奖】,恭喜你!!共下了【"+count+"】注,投资【"+totalMoney+"】元,获奖【"+(300*count)+"】万元");}else if(result==4){System.out.println("【四等奖】,恭喜你!!共下了【"+count+"】注,投资【"+totalMoney+"】元,获奖【"+(200*count)+"】万元");}else if(result==5){System.out.println("【五等奖】,恭喜你!!共下了【"+count+"】注,投资【"+totalMoney+"】元,获奖【"+(100*count)+"】万元");}else if(result==6){System.out.println("【六等奖】,恭喜你!!共下了【"+count+"】注,投资【"+totalMoney+"】元,获奖【"+(5*count)+"】元");}else{System.out.println("【望再接再厉】,sorry!!共下了【"+count+"】注,投资【"+totalMoney+"】元,获奖【"+(0*count)+"】元");}} else {System.out.println("请先购买彩票,再查看开奖情况!");}break;case 3:System.out.println("谢谢使用");return;default:System.out.println("输入错误");}}while(true);}/*** 随机生成一个中奖号* @return*/public static int[] getLuckNum(){int luckNum[]=new int[7];for(int i=0;i