import java.util.Scanner; public class Lianxi2 { public static void main(String[] args) { String S=""; int n=0; int m=0; System.out.println("---------------------"); System.out.println("|欢迎进入双色球彩票系统!|"); System.out.println("---------------------"); System.out.println("温馨提示:请按提示语进行操作哦!"); for(int i=1;i<=6;i++) { System.out.println("请输入您的红球号码"+i+":"); Scanner sc1 = new Scanner(System.in); int x= sc1.nextInt(); if(x>=1&&x<=39) { S+=x; S+=","; } else { System.out.println("你输入号码有误,请重新输入!"); i--; } } for(int j=1;j<=1;j++) { System.out.println("请输入你的蓝球号码"+j+":"); Scanner sc2 = new Scanner(System.in); int y =sc2.nextInt(); if(y>=1&&y<=16) { S+=y; } else { System.out.println("你输入号码有误,请重新输入!"); j--; } } System.out.println("你的彩票号码是"+S); String S1="33,21,10,8,13,27,1"; System.out.println("本次大奖号码是"+S1); String[]strs=S.split(","); for(int i=0;i<strs.length;i++) { switch (strs[i]) { case "33":{ n++; break; } case "21": { n++; break; } case "10":{ n++; break; } case "8": { n++; break; } case "13": { n++; break; } case "27": { n++; break; } } } switch (strs[6]) { case "1": { m++; n++; break; } default: break; } switch (n) { case 0:{ System.out.println("很遗憾,你未中奖!"); break; } case 1:{ if(m==1){ System.out.println("恭喜你,中了六等奖!"); } else { System.out.println("很遗憾,你未中奖!"); } break; } case 2:{ if(m==1) { System.out.println("恭喜你,中了六等奖!"); } else { System.out.println("很遗憾,你未中奖!"); } break; } case 3: { if (m == 1) { System.out.println("恭喜你,中了六等奖!"); } else { System.out.println("很遗憾未中奖!"); } break; } case 4:{ System.out.println("恭喜你,中了五等奖!"); break; } case 5:{ System.out.println("恭喜你,中了四等奖!"); break; } case 6:{ if(m==1) { System.out.println("恭喜你,中了三等奖!"); } else { System.out.println("恭喜你,中了二等奖!"); } break; } case 7:{ System.out.println("恭喜你,中了一等奖!"); break; } } } }
03-09
664
06-09
08-10
538