msg.java

来自「简单ATM(Automatic Teller Machine)系统的基本功能包括」· Java 代码 · 共 51 行

JAVA
51
字号
package atm;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author:Liangwen
 * @version 1.0
 */
public class Msg {
        // These are the first character of messages from client to server
        public static final int  PORTNUM = 9912;
        public static final int  ACCOUNT_LENGTH = 6;
        public static final int  PWD_LENGTH = 6;
        public static final char SEPARATOR = '#';
        public static final char SUCCESSFUL = 'S';     //服务器返回操作成功
        public static final char FAILED = 'F';        //服务器返回操作失败
        public static final char CMD_LOGIN = 'L';        //登录
        public static final char CMD_QUIT  = 'Q';       //退出
        public static final char CMD_QUERY = 'U';      //查询
        public static final char CMD_WITHDROW = 'W';  //取款
        public static final char CMD_DEPOSIT = 'D';  //存款
        public static final char CMD_CHANGE = 'C';  //修改密码
       // public static String currentAccount;

        //验证帐号或者密码长度是否合法,是否全为数字
        public static boolean isValid(String content,int length)
        {
                // check length
                if (content.length() != length)
                        return false;
                //检查是否全为数字
                try{
                    long temp;
                    temp=Integer.parseInt(content);
                }
                catch(ClassCastException e){
                    return false;
                }
                catch(Exception e){
                    return false;
                }
                return true;
        }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?