import java.util.Scanner; public class A01 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("我行我素购物管理系统>幸运抽奖"); Scanner input = new Scanner (System.in); System.out.println("请输入4位会员号:"); int number=input.nextInt(); int random=(int)(Math.random()*10000); if(number==random){ System.out.println(number+"号客户您是幸运客户,获得精美Mp3一个!"); }else{ System.out.println(number+"号客户谢谢您的支持,获得安慰奖一个!"); } } }
java-第四章-实现幸运抽奖功能,布布扣,bubuko.com
原文地址:http://1797077217.blog.51cto.com/8956560/1420158