import java.util.Arrays;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner input =new Scanner(System.in);
boolean flag = true;
int[] arr1 = new int[6];//下注红色号码
int[] arr2 = new int[1];//下注蓝色号码
int[] arr3 = new int[6];//开奖红色号码
int[] arr4 = new int[1];//开奖蓝色号码
int note = 0;
int jj = 0;
int ff = 0;
do {
System.out.println(“欢迎进入双色球彩票系统”);
System.out.println(“1.购买彩票”);
System.out.println(“2.查看开奖”);
System.out.println(“2.退出”);
System.out.println("*********************************************");
//购买彩票
System.out.println("购买彩票");
System.out.println("[双色球彩票系统>购买彩票]");
note = (int)(Math.random()*(10-1)+1);//随机注数
System.out.println("自动下注:"+note+"注");
int x = 0;
do {
for(int i = 0;i<arr1.length;i++) {
arr1[i] = (int)(Math.random()*(32-1)+1);//随机红色
}
x = 0;
int[] arr6 = Arrays.copyOf(arr1, 6);
for(int d = 0;d<arr1.length;d++) {
for(int i = 0;i<arr1.length;i++) {
if(arr6[d]==arr1[i]) {
x++;
}
}
}
}while(x>6);
for(int i = 0;i<arr2.length;i++) {
arr2[i] = (int)(Math.random()*(16-1)+1);//随机蓝色
}
System.out.println("您选择的号码是:\t");//遍历7个号码
for(int i = 0;i<arr1.length;i++) {
System.out.print(arr1[i] +"\t");
}
for(int i = 0;i<arr2.length;i++) {
System.out.println(arr2[i] +"\t");
}
System.out.println("您一共投【"+note+"】注,总金额为"+(note*2)+"元");//注数、金额
//查看开奖
System.out.println("查看开奖");
System.out.println("[双色球彩票系统>查看开奖]");
System.out.print("已买的彩票号码为:\t");
for(int i = 0;i<arr1.length;i++) {//遍历6个红色号码
System.out.print(arr1[i] +"\t");
}
for(int i = 0;i<arr2.length;i++) {//遍历1个蓝色号码
System.out.println(arr2[i] +"\t");
}
for(int i = 0;i<arr3.length;i++) {//随机6个红色开奖号码
arr3[i] = (int)(Math.random()*(32-1)+1);
}
for(int i = 0;i<arr4.length;i++) {//随机1个蓝色开奖号码
arr4[i] = (int)(Math.random()*(16-1)+1);
}
System.out.print("当期的中奖号码为:\t");//遍历开奖号码
for(int i = 0;i<arr3.length;i++) {
System.out.print(arr3[i] +"\t");
}
for(int i = 0;i<arr4.length;i++) {
System.out.println(arr4[i] +"\t");
}
int Counting1 = 0;//红色相同个数
int[] arr5 = Arrays.copyOf(arr1, 6);
for(int d = 0;d<arr1.length;d++) {
for(int i = 0;i<arr1.length;i++) {
if(arr5[d]==arr3[i]) {
Counting1++;
arr5[d]=0;
arr3[i]=100;
}
}
continue;
}
int Counting2 = 0;//蓝色相同个数
for(int i = 0;i<arr2.length;i++) {
if(arr2[i]==arr4[i]) {
Counting2++;
}
}
if(Counting1==6 && Counting2==1) {//奖项
System.out.println("【恭喜中奖,一等奖】,恭喜您 ||共下了【"+note+"】注,投资【"+(note*2)+"】元,奖金【10000000】元");
System.out.println("红色"+Counting1+"蓝色"+Counting2);
jj = 10000000;
}else if(Counting1==6 ){
System.out.println("【恭喜中奖,二等奖】,恭喜您 ||共下了【"+note+"】注,投资【"+(note*2)+"】元,奖金【100000】元");
System.out.println("红色"+Counting1+"蓝色"+Counting2);
jj =100000;
}else if(Counting1==5 && Counting2==1 ){
System.out.println("【恭喜中奖,三等奖】,恭喜您 ||共下了【"+note+"】注,投资【"+(note*2)+"】元,奖金"+(note*3000)+"元");
System.out.println("红色"+Counting1+"蓝色"+Counting2);
jj = 3000;
}else if(Counting1==4 && Counting2==1 || Counting1==5 ){
System.out.println("【恭喜中奖,四等奖】,恭喜您 ||共下了【"+note+"】注,投资【"+(note*2)+"】元,奖金"+(note*200)+"元");
System.out.println("红色"+Counting1+"蓝色"+Counting2);
jj = 200;
}else if(Counting1==3 && Counting2==1 || Counting1==4 ){
System.out.println("【恭喜中奖,五等奖】,恭喜您 ||共下了【"+note+"】注,投资【"+(note*2)+"】元,奖金"+(note*10)+"元");
System.out.println("红色"+Counting1+"蓝色"+Counting2);
jj = 10;
}else if(Counting1==2 && Counting2==1 || Counting1==1 && Counting2==1 ||Counting1==1 ){
System.out.println("【恭喜中奖,六等奖】,恭喜您 ||共下了【"+note+"】注,投资【"+(note*2)+"】元,奖金"+(note*5)+"元");
System.out.println("红色"+Counting1+"蓝色"+Counting2);
jj = 5;
}else {
System.out.println("【望再接再厉】,恭喜您 ||共下了【"+note+"】注,投资【"+(note*2)+"】元,奖金【0】元");
System.out.println("红色"+Counting1+"蓝色"+Counting2);
jj = 0;
}
ff++;
System.out.println("循环次数:"+ff);
//退出
if(Counting1==5 && Counting2==1) {//请输入红色个数和蓝色个数
System.out.println("退出");
flag = false;
break;
}
}while(flag = true);
}
}