package z4;
import java.util.*;
public class GoodLuck {
// 使用随机数产生方法生成一个int型的0-9之间的随机数,保存在变量random中 */
// 从控制台接收用户输入的一个4位会员号,作为int整数获取并保存在变量custNo中 */
// 对custNo进行运算,获得其百位上的数字,保存在变量baiwei中 */
// 根据变量baiwei和之前的random变量是否相等判断是否是幸运会员,如果是提示“恭喜您成为幸运客户,奖励精美mp3一个”,
// 否则提示“谢谢您的支持” */
public static void main(String[] args) {
// TODO Auto-generated method stub
Random i=new Random();
int random=(int)(Math.random()*10);
System.out.println("生成一个随机数;"+random);
System.out.print("用户输入一个4位会员号:");
Scanner n=new Scanner(System.in);
int custNo=n.nextInt();
int baiwei;
baiwei = (custNo % 1000) / 100;
if(baiwei==random);
System.out.println("恭喜你成为幸运客户,奖励MP3一个");
System.out.println("谢谢你的支持");
n.close();
}
}
import java.util.*;
public class GoodLuck {
// 使用随机数产生方法生成一个int型的0-9之间的随机数,保存在变量random中 */
// 从控制台接收用户输入的一个4位会员号,作为int整数获取并保存在变量custNo中 */
// 对custNo进行运算,获得其百位上的数字,保存在变量baiwei中 */
// 根据变量baiwei和之前的random变量是否相等判断是否是幸运会员,如果是提示“恭喜您成为幸运客户,奖励精美mp3一个”,
// 否则提示“谢谢您的支持” */
public static void main(String[] args) {
// TODO Auto-generated method stub
Random i=new Random();
int random=(int)(Math.random()*10);
System.out.println("生成一个随机数;"+random);
System.out.print("用户输入一个4位会员号:");
Scanner n=new Scanner(System.in);
int custNo=n.nextInt();
int baiwei;
baiwei = (custNo % 1000) / 100;
if(baiwei==random);
System.out.println("恭喜你成为幸运客户,奖励MP3一个");
System.out.println("谢谢你的支持");
n.close();
}
}