日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

幸运抽奖案例

發布時間:2023/12/3 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 幸运抽奖案例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
package xinyunchoujiang;import java.util.Scanner;/*** * * 項目名稱:19qn3 * 類名稱:CaiDan * 類描述: 幸運抽獎 * 創建人:Mu Xiongxiong * 創建時間:2020-4-2 下午5:13:15 * 修改人:Mu Xiongxiong * 修改時間:2020-4-2 下午5:13:15 * 修改備注: * 個人博客:https://blog.csdn.net/qq_34137397 * @version **/ public class CaiDan {static Scanner sc = new Scanner(System.in);static String name = "";static String pass = "";static int random = 0;static boolean isReg = false; //是否注冊static boolean isLogin = false; //是否登陸static int [] jiang = new int [4]; //隨機中獎客戶public static void main(String[] args) {menu();}// 菜單的方法public static void menu() {Scanner sc = new Scanner(System.in);String ji = "";do {System.out.println("*****歡迎進入獎客富翁系統*****");System.out.println("\t1.注冊");System.out.println("\t2.登錄");System.out.println("\t3.抽獎");System.out.println("***************************");System.out.print("請選擇菜單:");int choice = sc.nextInt();switch (choice) {case 1:System.out.println("[獎客富翁系統 > 注冊]");reg();break;case 2:System.out.println("[獎客富翁系統 > 登錄]");login();break;case 3:System.out.println("[獎客富翁系統 > 抽獎]");if(isLogin==true){choujiang();}else{System.out.println("還沒登陸呢,請登錄");}break;default:System.out.println("[您的輸入有誤!]");break;}System.out.println("繼續嗎?(y/n)");ji = sc.next();} while (ji.equals("y"));System.out.println("已經退出!!!");}//注冊public static void reg() {System.out.println("請輸入用戶名:");name = sc.next();System.out.println("請輸入密碼:");pass = sc.next();random = (int) (Math.random() * 10000);System.out.println("用戶名\t密碼\t會員卡號");System.out.println(name + "\t" + pass + "\t" + random);isReg = true;}//登陸public static void login(){if(isReg==true){for(int i = 1;i<=3;i++){System.out.println("請輸入用戶名:");String name1 = sc.next();System.out.println("請輸入密碼:");String pass1 = sc.next();if(name1.equals(name)&&pass1.equals(pass)){System.out.println("登錄成功");isLogin = true;break;}else if(i<3){System.out.println("還有"+(3-i)+"次機會");}else{System.out.println("沒有機會了");}}}else{System.out.println("還沒有注冊呢");}}//抽獎public static void choujiang(){System.out.println("請輸入您的卡號:");int kahao = sc.nextInt();for(int i = 0;i<4;i++){jiang[i] = (int)(Math.random()*10000);}System.out.println("中獎的卡號是:");for (int i : jiang) {System.out.print(i+"\t");}for (int i = 0; i < jiang.length; i++) {if(kahao==jiang[i]){System.out.println("您中獎啦");break;}}System.out.println("\n沒有中獎呢");}}

總結

以上是生活随笔為你收集整理的幸运抽奖案例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。