zoukankan      html  css  js  c++  java
  • 10章作业(全)

    import java.util.Scanner;

    public class Bh {
     public static void main(String[] args) {
      Scanner input = new Scanner(System.in);
      int max = 9999;
      int min = 1000;
      String name = "Tom";
      int password = 111111;
      String as = "y";
      int card = (int) (Math.random() * (max - min)) + min;
      do {

       System.out.println("******欢迎进入奖客富翁系统*****");
       System.out.println("      1.注册 ");
       System.out.println("      2.登录 ");
       System.out.println("      3.抽奖 ");
       System.out.println("*****************************");
       System.out.println("请选择菜单:");
       int xz = input.nextInt();
       if (xz == 1) {
        System.out.println("[奖客富翁系统>注册]");
        System.out.println("请填写个人注册信息:");
        System.out.print("请输入用户名:");
        name = input.next();
        System.out.print("请输入密码:");
        password = input.nextInt();
        System.out.println(" ");
        System.out.println("注册成功,请记住您的会员卡卡号");
        System.out.println("用户名         密码               会员卡号 ");
        System.out
          .println(name + "    " + password + "     " + card);
        System.out.print("还要继续吗?(y/n)");
        as = input.next();
       } else if (xz == 2) {
        System.out.println("[奖客富翁系统>登录]");

        System.out.println(" ");
        for (int i = 1; i <= 3; i++) {

         System.out.print("请输入用户名:");
         String name1 = input.next();
         System.out.print("请输入密码:");
         int password2 = input.nextInt();
         if (name.equals(name1) && password == password2) {
          System.out.println("欢迎您:" + name1);
          break;
         } else {
          System.out.println("请重新输入:");
         }
        }

        System.out.print("还要继续吗?(y/n)");
        as = input.next();
       } else if (xz == 3) {
        System.out.println("[奖客富翁系统>抽奖]");
        System.out.print("请输入您的卡号:");
        int kh = input.nextInt();
        System.out.println(" ");
        System.out.print("本日的幸运数字为:");
        for (int i = 0; i < 3; i++) {
         card = (int) (Math.random() * (max - min)) + min;
         System.out.print(card + " ");
        }
        if (kh == card) {
         System.out.print("恭喜,您是今日的幸运会员!");
        } else {
         System.out.print("抱歉,您不是今日的幸运会员!");
        }
        System.out.print("还要继续吗?(y/n)");
        as = input.next();

       }

      } while ("y".equals(as));
      System.out.print("系统退出,谢谢使用!");
     }
    }

  • 相关阅读:
    Cocos2d Box2D之动态刚体
    Cocos2d Box2D之简介
    Cocos2d-x之物理引擎
    Cocos2d-x之UI控件简介
    Cocos2d-x之数据的处理
    My First Django Project (3)
    My First Django Project (2)
    My First Django Project
    Python 学习笔记
    利用python scrapy 框架抓取豆瓣小组数据
  • 原文地址:https://www.cnblogs.com/LWLDD/p/6698262.html
Copyright © 2011-2022 走看看